1

Is there a way to do conditional mapping in EF 6 with Code First.

We have a table called Entity which holds Suppliers, Customers and Employees. There is a flag field which identifies if a record is supplier, customer, employee or a combination of them. So we are using enum flags. In our code we have three domain objects (Supplier, Customer and Employee). I want to map these objects to the Entity table based on the flag field. Can somebody please tell me if this is possible in EF6. Please note that we are using Code First

7
  • How close is this question to what you want to accomplish? Apr 1, 2014 at 0:32
  • The difference in my case is that I have one table - Entity which holds all different types of Entities (Supplier, Customer and Employee). So I don't think the two problems are related Apr 1, 2014 at 0:57
  • Do the Supplier, Customer and Employee classes derive from a common class? Apr 1, 2014 at 1:03
  • Yes they derive from the Entity class Apr 1, 2014 at 1:50
  • the description, isnt consistent to me. but sounds like msdn.microsoft.com/en-us/data/jj618292 is requried
    – phil soady
    Apr 1, 2014 at 13:50

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.