Question

I want to write a service method using ServiceStack (c#) and ServiceStack.OrmLite to save the dynamic objects, sent by client (in parameter), in a SQL Database. Also, this method will first create the table in database for this dynamic object. Service will be unable to recognize the class type of the object to be persisted as it will only be defined on client side.

I have explored OrmLite a bit and found that it has DatabaseTableConfig and DatabaseFieldConfig classes to persist an object with unknown type. Unfortunately I am unable to find these classes in ServiceStack.OrmLite library.

Any help in the coding strategy?

Was it helpful?

Solution

The Java OrmLite and the ServiceStack.OrmLite are not the same and as such the classes you refer to do not exist in ServiceStack.OrmLite.

Service will be unable to recognize the class type of the object to be persisted

As you are creating dynamic objects which you can't type, then an ORM (Object-relational mapping) is probably not the way to go, as ORM is all about using typed data.

The best approach would be to build the SQL queries yourself, and use a SqlCommand.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top