2
votes

I am building a service using ServiceStack and using OrmLite to communicate with database. I found following example in ServiceStack OrmLite Documention:

db.Select<Author>(q => q.Earnings <= 50);

OR

db.Select<Author>(q => q.Name.StartsWith("A"));

I am trying it with my class User, but unable to find a overload for method "Select" which allows me to do mentioned stuff. In my case q is a linq expression not an instance/reference for generic class type (User in my case). Following is my code:

db.Select<User>(q => q.Where(x => x.LastName == "XYZ"));

and i want it to be like:

db.Select<User>(q => q.LastName == "XYZ");

Please let me know if that is an extension method which i am looking for and how can i use that?

1

1 Answers

0
votes

The Type that gets selected is the table is looking at, e.g:

db.Select<Author>(...) //Author
db.Select<User>(...) //User

See the answers on this earlier question for selecting a subset of data with OrmLite.