You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
IDatabasedb=newDatabase("connStringName");// Maps to User objects includes populating Address propertyvarusers=db.Fetch<User>("select u.UserId, u.Name, u.Street, u.City from Users");
This will give you a list of User objects with the nested class Address mapped.
Note:
The order of the columns is extremely important. The columns in the query need to be specified in the same order as the generic parameters are specified. eg. The User columns are specified first, then the Address columns next.
If you are mapping to objects that are also used for inserting data then you will need to make sure you ignore the Address property using the [ResultColumn] attribute. From v3, you will additionally need the [ComplexMapping] attribute.