Suppose I have two table tab1, tab2. EF will create a edmx file and there are two entities created.
Then I want to add a computer member to tab1, which get some result from tab2, such as count, sum. What I used is partial class:
public partial class tab1{
public int Count{
get{
int cnt;
//...
return cnt;
}
}
public int Total{
get{
int total;
//the matching sql like select sum(column) from tab2
return total;
}
}
}
I want to cnt is counts in tab2(so the SQL should be select count(1) from tab2). Or total which is calculated from another table. But how to implement it? there is no something like datacontext yet.