We recently upgraded our software to .NET 4.0 and EF 4.0 (without self-monitoring objects) (formerly .NET 3.5 SP1). Now, in the previous working code, a new exception is raised that we do not understand.
We have an object called Resident, and another object called ResidentExtension, which extends the already large resident object with a ratio of 1 to (0/1). The following C # code generates a new object in our application:
Residents resident = new Residents()
{
IsNewResident = true,
ResidentImage = Settings.Default.ResidentCardDefaultMaleImage,
IsActive = true,
ResidentCanBeDeleted = true,
ResidentExtensions = new ResidentExtensions(),
ResidentMasterDataState = EvoState.Error,
ResidentBasicDataState = EvoState.Error,
ResidentBenefactorsDataState = EvoState.Error,
};
The following exception occurs immediately after this statement:
Violation of plurality. The ResidentExtensions role of the VOCURA.EntityDataModels.EvocuraCarehomeManagementEntityModel.FK_ResidentExtensions_Residents' relationship has a multiplicity of 1 or 0..1.
:
[XmlIgnoreAttribute()]
[SoapIgnoreAttribute()]
[DataMemberAttribute()]
[EdmRelationshipNavigationPropertyAttribute("EVOCURA.EntityDataModels.EvocuraCarehomeManagementEntityModel", "FK_ResidentExtensions_Residents", "ResidentExtensions")]
public ResidentExtensions ResidentExtensions
{
get
{
return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<ResidentExtensions>("EVOCURA.EntityDataModels.EvocuraCarehomeManagementEntityModel.FK_ResidentExtensions_Residents", "ResidentExtensions").Value;
}
set
{
((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<ResidentExtensions>("EVOCURA.EntityDataModels.EvocuraCarehomeManagementEntityModel.FK_ResidentExtensions_Residents", "ResidentExtensions").Value = value;
}
}
, , - , ResidentExtension (ResidentID) . , .
- , ?