pardie
pardie

Reputation: 509

Raw results from ServiceStack.OrmLite query

I'm wondering if there's a way to get "raw" results from a OrmLite query in ServiceStack.

I'll explain... I know I can use:

var results = Db.SqlList<MyModel>("SELECT * FROM TableName");

passing the model of my output results, but if I don't know it? Can I get "raw" results without know the types of the data I'm reading?

Thank you

Upvotes: 1

Views: 385

Answers (1)

mythz
mythz

Reputation: 143284

Have a look at the support of Dynamic Result sets in OrmLite.

Where you can access an un-typed schema with a List<object>, e.g:

var results = Db.SqlList<List<object>>("SELECT * FROM TableName");

Or if you want the column names as well you can use:

var results = db.Select<Dictionary<string,object>>("SELECT * ...");

OrmLite also has a version of Dapper embedded if you prefer to access the results using dynamic instead, e.g:

IEnumerable<dynamic> results = db.Query("SELECT * FROM TableName");

Upvotes: 1

Related Questions