c# - Combining multi coloumn failover logic into a single property in Entity Framework 4.1 -
c# - Combining multi coloumn failover logic into a single property in Entity Framework 4.1 -
i working on legacy enterprise database uses multiple columns retrieve part number sql utilize checks part number , if part number null checks kid part number best way of combining logic single ef model property (eg product.partnumber )
i invisible possible partnumber visible externally info api
if using code-first approach way projection in custom linq-to-entities query:
var products = context.products .select(p => new somenonmappedtype { id = p.id, // other fields partnumber = p.partnumber ?? p.child.partnumber // hope work }); if using edmx can utilize definingquery or queryview whole new entity readonly. more in another answer.
c# asp.net-mvc-3 entity-framework-4.1
Comments
Post a Comment