How do you fashion projections in SubSonic 2.2? Basically I wish to return columns from two tables that are joined.
+3
A:
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>();
Adam
2009-08-07 07:50:02