#1 Re: mORMot 1 » Accessing TSQLRestServerURIContext content » 2014-06-27 09:37:03

ael

Thanks a lot! I used this structure with a TDocVariantData.InitJSON and it works beautifully.

#2 mORMot 1 » Accessing TSQLRestServerURIContext content » 2014-06-26 15:22:10

ael
Replies: 2

Hello,

I'm using published methods on the server and get a TSQLRestServerURIContext with the client request.

It's very easy to access parameters through the InputDouble[], ... but I cannot figure out how to access the body (which is JSON data) if the method is POST/PUT.

Is there a way to easily access this data (I wish to deserialize the body into a class) or should I unserialize manually?

#3 Re: mORMot 1 » Using CRUD with interfaces » 2014-03-20 10:55:38

ael

Hello,

Thank you for the tip. I've tried to implement a proof-of-concept and can indeed access verbs easily.

I had one question related to marshalling the result however. For now I'm working with a class derived from TSQLRecord with a few published properties. Is there a better way to return the result (through Ctxt.Result) than by doing a ObjectToJSON(myClass)?

Will it work with UrlDecodeObject you mention in the SAD (15.3) or should I use something else to unmarshall the returned value?

#4 Re: mORMot 1 » Using CRUD with interfaces » 2014-03-19 10:46:11

ael

Bonjour,

I've read the documentation more carefully and was able to attain what I was hoping for by subclassing the TSQLRestServer class and implementing EngineRetrieve/List/Add/...

Is it the proper way to do it? Any pitfall I should be aware of?

This is indeed a superb library, I've made a donation to thank you for your work.

#5 mORMot 1 » Using CRUD with interfaces » 2014-03-18 13:38:27

ael
Replies: 4

Hello,

Some background: I work on an existing client-server software and I'd like to extract the database part to expose objects via a RESTful server. I'm evaluating various library (Datasnap, DataAbstract, mORMot, ...) to pick the right one for the job. So far mORMot seems incredible, but I had a question I did not find an answer to in the documentation.

As the database is quite complex and will not properly map to an ORM (tables & fields have prefix, I need more control server-side for locking, ...) I wanted to use interface-based services. It works beautifully, but unfortunately not in a CRUD way.

I was wondering if it's possible to use CRUD by registering hooks.

Ideally I'd like to register objects quite like I register services (ServiceRegister(TObjectA, [TypeInfo(IObjectA)], sicShared);), have mORMot handle the CRUD/REST parsing, and have a function get called with the eventual JSON data provided by the client and the method (GET, POST, ...). My function would return a JSON serialized string (or record).

Is it possible or do I have to use the integrated ORM feature to have a proper REST addressable server (or am I completely in the wrong and should not build the server like that)?

Board footer

Powered by FluxBB