none
Deleted RRS feed

Answers

  • Hi Oleksandr,

    I think you are on the right track here, I don't know of any easier ways to do this at the moment.

    In your derived class you should be able to configure it to map the way you want with the ToTable method. Something like:

    modelBuilder.Entity<CustomLineOrder>().ToTable("CustomLineOrder");

    That should convert it to a TPT mapping that will leave the base class mapped to OrderLine and put the new properties into the CustomOrderLine table. You would do this in your derived DbContext, either in OnModelCreating directly or with another mapping class specifically for CustomOrderLine. You shouldn't need to change the OrderLine mapper.

    overriding the OrderLines or adding a new property both should work, I think. I haven't tried it though so I am not 100% sure. Let me know if you have problems with it and I will help with each one as they come up.


    We are seeing a lot of great Entity Framework questions (and answers) from the community on Stack Overflow. As a result, our team is going to spend more time reading and answering questions posted on Stack Overflow. We would encourage you to post questions on Stack Overflow using the entity-framework tag. We will also continue to monitor the Entity Framework forum.


    Tuesday, November 27, 2012 7:14 PM
    Moderator

All replies

  • Hi Oleksandr,

    I think you are on the right track here, I don't know of any easier ways to do this at the moment.

    In your derived class you should be able to configure it to map the way you want with the ToTable method. Something like:

    modelBuilder.Entity<CustomLineOrder>().ToTable("CustomLineOrder");

    That should convert it to a TPT mapping that will leave the base class mapped to OrderLine and put the new properties into the CustomOrderLine table. You would do this in your derived DbContext, either in OnModelCreating directly or with another mapping class specifically for CustomOrderLine. You shouldn't need to change the OrderLine mapper.

    overriding the OrderLines or adding a new property both should work, I think. I haven't tried it though so I am not 100% sure. Let me know if you have problems with it and I will help with each one as they come up.


    We are seeing a lot of great Entity Framework questions (and answers) from the community on Stack Overflow. As a result, our team is going to spend more time reading and answering questions posted on Stack Overflow. We would encourage you to post questions on Stack Overflow using the entity-framework tag. We will also continue to monitor the Entity Framework forum.


    Tuesday, November 27, 2012 7:14 PM
    Moderator
  • Deleted
    Tuesday, November 27, 2012 9:26 PM
  • Deleted
    Wednesday, November 28, 2012 2:32 PM