Skip to content

DelphiMVCFramework 3.2.3-radium

Compare
Choose a tag to compare
@danieleteti danieleteti released this 02 Feb 18:16
· 606 commits to master since this release

What's New in 3.2.3-radium

  • ⚡ Default error responses contains the official "reason string" associated to the HTTP status code (this can be a breaking change for some generic client which doesn't correctly interpret the http status code)

  • ⚡ Added static method HTTP_STATUS.ReasonStringFor(HTTPStatusCode) wich returns the standard ReasonString for a given HTTP status code.

  • ⚡ Improved handling of TMVCErrorResponse information

  • ⚡ mid-air-collision handling now uses SHA1 instead of MD5

  • ⚡ Added MVCFramework.Commons.MVC_HTTP_STATUS_CODES const array containing all the HTTP status codes with its ReasonString.

  • ⚡ Support for TObject descendants in JSONRPC APIs (not only for JSONObject and JSONArray).

  • ⚡ New global configuration variable MVCSerializeNulls.

    • When MVCSerializeNulls = True (default) empty nullables and nil are serialized as json null.
    • When MVCSerializeNulls = False empty nullables and nil are not serialized at all.
  • ⚡ Nullable types now have Equal method support, the new method TryHasValue(out Value) works like HasValue but returns the contained value if present. Also there is a better "equality check" strategy.

  • ⚡ Unit tests now are always executed for Win32 and Win64 bit (both client and server).

  • ⚡ Added TMVCActiveRecord.Refresh method

  • ⚡ Unit test suites generates one NUnit XML output file for each platform

  • ⚡ New built-in profiler (usable with Delphi 10.4+) - to profile a block of code, write the following

    procedure TMyController.ProfilerSample1;
    begin
      NotProfiled(); //this line is not profiled
      //the following begin..end block will be profiled
      //timing will be saved in a "profiler" log
      begin var lProf := Profiler.Start(Context.ActionQualifiedName);
        DoSomething();
        DoSomethingElse();
        Render('Just executed ' + Context.ActionQualifiedName);
      end; // profiler writes automatically to the log
      NotProfiled(); //this line is not profiled
    end;
    
    procedure TMyController.DoSomething;
    begin
      begin var lProf := Profiler.Start('DoSomething');
        Sleep(100);
      end;
    end;
    
    procedure TMyController.DoSomethingElse;
    begin
      begin var lProf := Profiler.Start('DoSomethingElse');
        Sleep(100);
        DoSomething();
      end;
    end;
    
    procedure TMyController.NotProfiled;
    begin
      Sleep(100);
    end;

    The log contains the following lines - check the caller/called relationship shown using >> and << and the deep level

    [>>][     1][MainControllerU.TMyController.ProfilerSample1] [profiler]
    [ >>][     2][DoSomething] [profiler]
    [ <<][     2][DoSomething][ELAPSED: 00:00:00.1088214] [profiler]
    [ >>][     2][DoSomethingElse] [profiler]
    [  >>][     3][DoSomething] [profiler]
    [  <<][     3][DoSomething][ELAPSED: 00:00:00.1096617] [profiler]
    [ <<][     2][DoSomethingElse][ELAPSED: 00:00:00.2188468] [profiler]
    [<<][     1][MainControllerU.TMyController.ProfilerSample1][ELAPSED: 00:00:00.3277806] [profiler]
    

    To get more info check the "profiling" example.

    All profiler logs are generated with a log level info. If measured time is greater than WarningThreshold the log level is warning.

    WarningThreshold is expressed in milliseconds and by default is equals to 1000.

  • ⚡ New Context property named ActionQualifiedName which contains the currently executed action in the form UnitName.ClassName.ActionName. It is available where the Context property is available. Obviously is not available in the OnBeforeRouting middleware events.

  • ⚡ Added ObjectPool and IntfObjectPool (and related unit tests). Thanks to our sponsor Vivaticket S.p.A.

  • ⚡ Method procedure Render(const AErrorCode: Integer; const AErrorMessage: string = '' ... has been renamed to RenderStatusMessage with a better parameter names.

  • IMVCJSONRPCExecutor supports async call. Thanks to our sponsor Orion Law. Check the new Async sample in samples\jsonrpc_with_published_objects\.

  • ⚡ Removed foTransient if TMVCActiveRecord FieldOptions. It became obsolete after introduction of foReadOnly and foWriteOnly.

  • ⚡ Improved TMVCActiveRecordMiddleware. Now it can handle multiple connections for the same request. Also, you can completely omit the 'default' connection and just specify wich connection you want to use before starting to create your TMVCActiveRecord inherited entities.

Bug Fix in 3.2.3-radium

More details about dmvcframework-3.2.3-radium fixes here