EntityFramework 6 RC1 Include on Many-to-Many property fails

后端 未结 1 407
生来不讨喜
生来不讨喜 2021-01-18 17:47

I have a many-to-many relationship between Agents and AgentGroups (psuedocode, abbreviated).

public class Agent { 
    public virtual List          


        
相关标签:
1条回答
  • 2021-01-18 18:46

    In rc1 there appears to be a change in naming convention of the junction table in many-to-many associations. When I try your model in various EF versions, this is what I see:

    • EF5 (stable): AgentGroupAgents
    • EF6 (beta): AgentGroupAgents
    • EF6 (rc1): AgentAgentGroups

    It wouldn't be bad if the beta was different, but rc1 differs from the last RTM version, which makes this a breaking change. Good catch!

    Edit

    Answer from the EF team:

    Hello,
    Prior to EF6 there were some areas of model creation that were non-deterministic - depending on whether you were running on x86 or x64 you could get a different model. The many to many join table name was one of these areas. In EF6 we addressed this to ensure the results would always be the same. Unfortunately, that does mean that for some models (depending on which architecture they were running on) upgrading to EF6 can cause a model change. But the model that is now calculated will be consistent across machines and future versions of EF. If you want to continue using the original name, the best option is to use the Fluent API to specify the join table name.
    ~Rowan

    0 讨论(0)
提交回复
热议问题