Reputation: 227
How do you fashion projections in SubSonic 2.2? Basically I wish to return columns from two tables that are joined.
Upvotes: 1
Views: 80
Reputation: 8677
My personal preference for how to do this is to create a SQL View which joins the table and have subsonic generate an object that maps to it.
You can also use ExecuteTypedList with a custom defined object for example:
public class TestObject{
int Column1 { get; set; }
int Column2 { get; set; }
}
List<TestObject> testObjects = DB.Select(Table1.Columns.Column1, Table2.Columns.Column2)
.From(Table1.Schema)
.InnerJoin(Table2.Schema)
.ExecuteTypedList<TestObject>();
Upvotes: 3