Call DbModelBuilder.Entity<>.Map<> twice generate exception RRS feed

  • Question

  • Hi everybody.

    Reading Microsoft online help of EntityTypeConfiguration<TEntityType>, in concrete Map<TDerived> method I read:

    "Allows advanced configuration related to how a derived entity type is mapped to the database schema. Calls to this method are additive, and subsequent calls will not override configuration already performed by previous calls to this method. "

    When I call MyModelBuilder.Entity<MyEntity>.Map<MyDerivedEntity>(m=> .....) twice, EF generate an exception:

    "The derived type 'MyDerivedType' has already been mapped using the chaining syntax. A derived type can only be mapped once using the chaining syntax."

    Where is the problem, it's a code bug, a help document bug or I'm doing something wrong?



    Friday, March 15, 2013 10:44 AM

All replies

  • Hi,

    IMO post rather the actual line of code rather than a description (it would avoid to let us imagine what you called and with which arguments). Your intent may also help (in case the call sequence would not match what you are trying to do).

    Please always mark whatever response solved your issue so that the thread is properly marked as "Answered".

    Friday, March 15, 2013 9:27 PM