how to populate an entity you have extended in the Entity Framework?
Posted
by user169867
on Stack Overflow
See other posts from Stack Overflow
or by user169867
Published on 2010-06-08T18:38:21Z
Indexed on
2010/06/08
18:42 UTC
Read the original article
Hit count: 235
I have an entity in my EDMX that I've extended with a few fields in a partial class like this:
public partial class Employee
{
public string JobName {get;set;}
}
These properties are for display only. In the above example say the entity has a JobTypeID property. I wish JobName to be populated w/ the name that belongs to that JobTypeID.
Is there anyway to query the employee record in EF including the value for the JobName property w/o explicity assigning each field using select()?
The reason I ask is that there are a lot of fields in the Employee entity so I'd like to be able to take advantage of something like:
ctx.Employees.Where(e=>e.EmployeeID==employeeID).Single()
...add somehow fill in JobName too
Is this possible?
© Stack Overflow or respective owner