Reputation: 2828
I am learning EF 4 staff and really got stacked. I am using Code First approach eg.
public class Machine{
public int A{get;set;}
...
}
I am trying to implement business logic in additional property based on the A property (eg. B = A+5) and present it in WPF datagrid. This new property doesn't need to be stored in database at all. How would I do that (e.g. with partial class )? Any examples?
Upvotes: 0
Views: 491
Reputation: 5815
If you are using EF 4.1 you can just use the not mapped attribute. If you are using the edmx designer, i beleive you can remove the column name it assigns to in the model viewer table mappings
Upvotes: 1
Reputation: 2380
public class Machine
{
public int A { get; set; }
[NotMapped]
public int B
{
get
{
return A + 5;
}
}
}
This should work.
Upvotes: 3