Reputation: 4646
Given the two Entities ProcessTemplateOperation and ProcessTemplateMetaInformation with a relation 1 to 0..1
When I add a ProcessTemplateOperation which HAS a ProcessTemplateMetaInformation I get the following error at Context.ApplyChanges (in EF it is in AddHelper.AddAllEntities: context.AddObject)
Multiplicity constraint violated. The role 'ProcessTemplateOperation' of the relationship '...FK_ProcessTemplateOperation_MetaInformation' has the multiplicity 1 or 0..1.
The debugger staying in the EntityFramework code says that the Operation has a Metainformation, so it is not lost on the way.
The definition of the RelationShip is
<AssociationSet Name="FK_ProcessTemplateOperation_MetaInformation" Association="FireStartDBModel.Store.FK_ProcessTemplateOperation_MetaInformation">
<End Role="ProcessTemplateOperation" EntitySet="ProcessTemplateOperation" />
<End Role="ProcessTemplateMetaInformation" EntitySet="ProcessTemplateMetaInformation" />
</AssociationSet>
<Association Name="FK_ProcessTemplateOperation_MetaInformation">
<End Role="ProcessTemplateOperation" Type="FireStartDBModel.Store.ProcessTemplateOperation" Multiplicity="1">
<OnDelete Action="Cascade" />
</End>
<End Role="ProcessTemplateMetaInformation" Type="FireStartDBModel.Store.ProcessTemplateMetaInformation" Multiplicity="0..1" />
<ReferentialConstraint>
<Principal Role="ProcessTemplateOperation">
<PropertyRef Name="Id" />
</Principal>
<Dependent Role="ProcessTemplateMetaInformation">
<PropertyRef Name="Id" />
</Dependent>
</ReferentialConstraint>
</Association>
<AssociationSet Name="FK_ProcessTemplateOperation_MetaInformation" Association="FireStartDBModel.FK_ProcessTemplateOperation_MetaInformation">
<End Role="ProcessTemplateOperation" EntitySet="BaseOperation" />
<End Role="ProcessTemplateMetaInformation" EntitySet="BaseMetaInformation" />
</AssociationSet>
And there is a NavigationProperty from the ProcessTemplateOperation but NO Navigation property on ProcessTemplateMetaInformation.
We are using TPC and ProcessTemplateOperation has a Base class BaseOperation and a derived class ProcessOperation...
Thanks for any help!
Upvotes: 2
Views: 3329
Reputation: 4646
We solved the issue.
We had some Navigationproperties which were running in a circle.
We removed them and everything works fine now!
Upvotes: 1