I would like to use AutoQuery, but I don’t use ORMLite till now, and I need to create queries with dynamic SQL and parameters . I don’t access directly tables or views in the SQL Server.
If I define POCOS, can I use ORMLite and AutoQuery for dynamic SQL ?
Don’t know what you mean by dynamic SQL, if it refers to a feature documented in the wiki: https://github.com/ServiceStack/ServiceStack/wiki/Auto-Query
Yes, otherwise you’d to provide a more concrete example.
Stefan Tsalapatis:
+Demis Bellot
I don’t know ORMLIte.
Can we have an SQL statement like
List<Dog> =db.Select<Dog>(
(“select Name from Dogs where Age =@Age”);
Can we use AutoQuery to provide the parameter values like /Dog?Age=9 ?
+Stefan Tsalapatis Right, but this is why we spend a lot of time to create docs so you can learn how to use them and what features are available: https://github.com/ServiceStack/ServiceStack.OrmLite and https://github.com/ServiceStack/ServiceStack/wiki/Auto-Query
Yes, Ormlite handles custom SQL:
https://github.com/ServiceStack/ServiceStack.OrmLite#typed-sqlexpressions-with-custom-sql-apis
Custom queries can be created in AutoQuery with [QueryField] or implcit conventions see: https://github.com/ServiceStack/ServiceStack/wiki/Auto-Query#customizable-adhoc-queries
Stefan Tsalapatis:
+Demis Bellot
you are right, that I have not spent time to read all docs, because of work overload and because I use already other tools for this job.
When you say that in OrmLite "one class is one table"
I have misunderstood that the Person in the example of the custom SQL, must be a table in the SQL. Not a POCO , in service side, to get the results of the dynamic SQL statement. If this is correct, then I will be happy to use the ORMLite and AutoQuery.
You need to install the SqlServer NuGet package, e.g ServiceStack.OrmLite.SqlServer
https://github.com/ServiceStack/ServiceStack.OrmLite#download