MARS-Curiosity: new features! DI, FireDAC, records and more

I know, everybody is looking at the new Linux support in Delphi 10.2 Tokyo but I think this post has to come before the one about Linux support for MARS-Curiosity (spoiler: a penguin has been spotted on MARS 🙂 ).

During these weeks I worked a lot on making MARS a better REST library, easy to use for every Delphi developer (letting the developer to focus on application code rather than on middleware concepts), trying to take advantage of all the most modern language features and techniques. A special mention goes for the new Dependency Injection mechanism, used internally to provide context-related values to resources but also extendible so each developer can add its own injection services that may be useful in the application code (think about third party DAC libraries, ORMs, document engines, and whatever may be needed to accomplish client’s requests).

Since the beginning of this project, my main aim has always been to build a Delphi library that is feature rich, easy to use, easy to extend (to be paired with other existing Delphi technologies/libraries) but lightweight (avoiding to force you to embrace a single philosophy or some other frameworks/dependencies).

The list of the new features is long (with 70+ commits) and I also had a chance to refactor some parts of the codebase I wanted to improve. Just let me mention the additions to the FireDAC support that makes it easier to perform queries against databases (including capability of handling multiple connection definitions, embedded rightly into MARS configuration files, and transaction support) and the new features related to record types (including generic MessageBodyReader and MessageBodyWriter implementations).

Here is a first list of the new features available in MARS master branch. In the next weeks more blog posts will follow to cover the more relevant topics:

Thanks for the new capabilities you’re worked on !
I am looking a little deeper in your FireDacBasic demo and have some questions:
If I have more than one dataset in the server.maindata, I get all data from all queries even if I link only one dataset to a MARSFDResource. How can we access only to one FDQuery ? How can I use subresources ? When I use the code in comment like [GET, Path(‘/standard’)] function StandardDataSet: TArray or TDataset; I get a XML file which can not be typecasted in a MARSFDResourceDataset. The global GET server response is crypted even if we don’t use any token, the subresource (ie /standard) is not. I hope my question is understandable !