DelphiMVCFramework at the 10° Delphi Meetup in Dresden , Germany

Mathias Pannier did a nice talk at the 10° Delphi Meetup in Dresden, Germany. You can find his review with the slide (both in english) in his blog.

Mathias contacted me about some specific questions the audience did.

Here’s my replies.

  • Is it possible to have a [MapperJSONSer(‘first_name’)] attribute for DataSet fields?
    • Not currently. It quite simple to implement but now this feature is available only for objects using RTTI attributes. Maybe in the near future this will be extended also to dataset serialition.
  • Is it possible to implement a custom renderer for example for xml output?
    • Sure! DMVCFramework is really opened to extensions. You can implement renders for every format you like, you are not tied to the built in.
  • Which Delphi edition is required? Starter, Professional, Enterprise, Ultimate?
    • DMVCFramework requires Professional version, because WebBroker is available from that version upwards.
  • Did You have any performance comparison?
    • Yes, it is not a complete test, is just a rough test between DMVCFramework and nodejs. DMVCFramework is not running into Apache or IIS, but is using its INDY default web server so the actual performance using a real webserver are far better.

dmvcframework_nodejs_preliminary_test

I’m planning to do more tests and as sson I’ll do them, will be published here and in the facebook group.

  • What about documentation?
    • The framework is quite intuitive, so after read this presentation (ITDevCon2013) you can go though all the samples (which covers all the features) and you will be up&running in in an hour or so.
    • However, some volenterous users, are starting to work on a more structured documentation. There will be a markdown generated site which will provide tutorial and devguide.

 

Still thank you to all the people which actively partecipating in this project.

 

Stay tuned.

 

 

DelphiMVCFramework is now Open Source!

delphimvcframework

Yes, just after 1 year of development, and a couple of big projects developed with it, the DelphiMVCFramework has been published as OpenSource.

The project is on google code svn https://code.google.com/p/delphimvcframework/

I’ll talk about it at ITDevCon2013 (http://www.itdevcon.it)

In the trunk there are many samples and I’m planning to put many others.

Main DMVCFramework features

  • RESTful (RMM Level 3) compliant
  • Server side generated pages using eLua (Embedded Lua)
  • Messaging extension using STOMP (tested with Apache Apollo and Apache ActiveMQ)
  • Can be used in load balanced environment using memcached (memcached.org)
  • Fancy URL with parameter mappings
  • Integrated RESTClient
  • Works with XE4 and XE5 (tested, but should works also on XE3 and XE2)
  • Experimental support for IOCP
  • Simple, but very very simple, to use…

It contains also a lot of indipendent code that can be used in other kind of projects.

These are the most notable:

  • Mapper (convert JSON <=> Object, ObjectList <=> JSONArray, ObjectLists <=> DataSets)
  • LuaBinding (integrate Lua script into Delphi native code)
  • LuaTextFilter (convert eLua into plain Lua executable script just like JSP)
Currently DMVCFramework use Embarcadero WebBroker framework, but is not tied to it. I’m working on a version that use IOCP (that is 10 times faster than plain WebBroker) and other web libraries for Delphi.
Code is enough stable and is already used in big production system.
WARNING!
There are a couple of bugs that affect WebBroker and so, DMVCFramework.
In our system, I’ve applied some patches to solve these problems. If you need those patches, ask me (I cannot publish the full code because it is Embarcadero licensed code).
The bugs are:
And another bug that affect also DataSnap and TIdHTTPWebBrokerBridge based projects.
Code is tested on XE4 and XE5 but should works also on XE3 and XE2.

Sneak peek to simple integration between DMVCFramework and DORM

This is a really simple (not optimized and dirty) integration between the upcoming DMVCFramework (WebBroker based MVC framework) and DORM, “the Delphi ORM”.

This is the DMVCFramework controller with the relative mapping and methods. In the method “GetUsers” dorm is used to execute a select to the database using the sanitized parameter passed on the url.

unit UsersControllerU;

interface

uses MVCFramework, dorm;

type

  [MVCPath('/users')]
  TUsersController = class(TMVCController)
  strict private
    dormSession: TSession;

  strict protected
    procedure MVCControllerAfterCreate; override;
    procedure MVCControllerBeforeDestroy; override;

  public
    [MVCPath('/($id)')]
    [MVCHTTPMethod([httpGET])]
    procedure GetUsers(CTX: TWebContext);
  end;

implementation

uses
  dorm.loggers, dorm.adapters, dorm.Commons, UsersBO;

{ TUsersController }

procedure TUsersController.GetUsers(CTX: TWebContext);
var
  User: TUser;
begin
  User := dormSession.Load &lt; TUser &gt; (CTX.Request.ParamsAsInteger['id']);
  Render(User);
end;

procedure TUsersController.MVCControllerAfterCreate;
begin
  inherited;
  dormSession := TSession.CreateConfigured('dorm.conf', TdormEnvironment.deDevelopment);
end;

procedure TUsersController.MVCControllerBeforeDestroy;
begin
  dormSession.Free;
  inherited;
end;

end.

Now, if you run the application and go to http://localhost/users/1 (the server is running on port 80), you’ll get the following:

Stay tuned.