DelphiMVCFramework 3.0.0-hydrogen is out!

Summary: DelphiMVCFramework 3.0.0-hydrogen is out! Tons of new features are available. Let’s see what’s new!

  Yes! After 18 months of development, more than 10 contributors (with a special thanks to Ezequiel Juliano Müller) and more than 500 commits, DelphiMVCFramework 3.0.0-hydrogen is finally out! It is a big releases with a lot of changes, refactorings and new features. All the 2.x users are strongly encouraged to migrate to this version.

The latest version will be always available at this link. Please, check that the suggested installation procedure is different from the 2.x branch. You have just to download the zip from the previous link and put the paths in the Delphi libs path. That’s it! Then, you have Delphi Ent+ you can also install the IDEExpert, however the IDEExpert is not required to use the framework… it is just an helper.

To help the migration from the 2.1.x branch, we wrote the breaking changes list.

DelphiMVCFramework 3.0.0 breaking changes

  • XE6 and previous versions are no more supported.
  • RenderListAsProperty<T> has been removed from TMVCController. You can set such kind of specialized serializations in your custom base controller.
  • RenderJSONArrayAsProperty has been removed from TMVCController. You can set such kind of specialized serializations in your custom base controller.
  • Render has been removed from TMVCController (was deprecated).
  • Render(TJSONValue) has been removed from TMVCController (use Render(TObject)).
  • Trying to deserialize a TJSONNull the target instance will not be freed anymore (consistency with serialize).
  • The default JSON engine, used in the framework, is no more the Delphi built-in but the excellent JSONDataObjects.
  • Context.Request.BodyAsJSONObject doesn’t exist any more.

Use BodyAs<T> or the following pattern to migrate:

    JSON := TJSONObject.ParseJSONValue(Context.Request.Body) as TJSONObject;
    try
      if not Assigned(JSON) then
        raise EMVCException.Create('Invalid JSON');
      // do something here
    finally
      JSON.Free;
    end;
  • TMVCConfigKey moved to unit MVCFramework.Commons.
  • TMVCMimeType was renamed to TMVCMediaType.
  • TMVCController.Render no parameter method do not exist anymore. If the return is a ResponseStream, use the RenderResponseStream.
  • TMVCController.PushJSONToView was renamed to TMVCController.PushToView and has been removed the System.JSON dependency, use the .ToJSON method if necessary.
  • There is no more a default view engine for Server Side Views (before 3.0 there was mustache).
  • Mustache engine is no more the only view engine available. Now you can implement all the view engines you need (check the serversideviewsprimer).
  • On Linux there is no built-in available view engine available. In other words, using only the built-in classes, you cannot use server side views on linux (dmustache is not compatible on linux).
  • HTTP File Upload doesn’t work on Linux because of a bug in Delphi 10.2.0.
  • [MapperJSONNaming(TJSONNameCase.JSONNameLowerCase)] now must be changed in [MVCNameCase(ncLowerCase)]
  • [MapperJSONNaming(TJSONNameCase.JSONNameUpperCase)] now must be changed in [MVCNameCase(ncUpperCase)]
  • Removed LogEx and LogException. Use Log.ErrorFmt instead.
  • PushObjectToView has been deprecated. Use ViewData property;
  • PushDataSetToView has been deprecated. Use ViewDataSet property;
  • ViewModels has been renamed in ViewData[];
  • ViewDataSets has been renamed in ViewDataset[];

TRESTClient specific breaking changes

  • Every reference to TJSON* has been removed from the TRESTClient public interface. To port the existing code, you have to include MVCFramework.RESTClient.SystemJSONUtils and change your code as following:

Before

lMyJSONObject := Response.BodyAsJsonObject.Clone as TJSONObject;

After

lMyJSONObject := TSystemJSON.BodyAsJsonObject(Response) as TJSONObject; 
try 
  //use the object 
finally 
  lMyJSONObject.Free; 
end;
  • The memory allocated for the TJSONValue descendant (e.g. TJSONObject, TJSONArray and so on) is no more managed by the TRESTClient itself but must be feed by the calling code.
  • DelphiStompClient has been removed from the core.
  • The following method is no more available in TMVCController.
    function GetNewStompClient(const AClientId: string = ‘’): IStompClient;
  • TMVCConfigKey.ISAPIPath has been substituted with TMVCConfigKey.PathPrefix and now is applicated to all kind of projects (not only ISAPI);
  • MapperSerializeAsString attribute is now MVCSerializeAsString
  • ContentCharset is no more available (everywhere). You have to properly set ContentType. To do that is available the function CreateContentType.

 

Conclusions

If you are on Delphi XE7+ there are no reason (apart time/money) to mantain a 2.x server. The change is smooth and simple. The DMVCFramework team already did portings for a lot of customers and the porting is a matter of hours, not days nor weeks…. just hours. Many users already did the change.

 

DelphiMVCFramework Book

Considering the high demand, I’m starting to write a DelphiMVCFramework book that will cover from the basic utilization to the advanced scenarios with a lot real-world samples and how to sections. The book will be available ASAP through the leanpub platform as DelphiMVCFramework Handbook.

Enjoy!

Comments

comments powered by Disqus