I have an invalid model (attached: Validation_Invalid.edmx). The model is using TPT Inheritance and raises validation error:
Error 1 Error 3036: Problem in mapping fragments starting at lines 180, 186, 196, 206, 211:Mapping fragments cannot be joined. Ensure every mapping fragment maps a key on which it should be joined with one of the other mapping fragments.
The reason for this error is that the EELabelFrozenId property is exposed on the EELabelFrozen entity instead of being mapped to the InfoId property on the Info entity which is its base type. If I map this property correctly the error goes away (see Validation_Fixed.edmx)
However if in the invalid model I delete the RawColumn entity (which is mapped correctly and does not seem to be related to the validation errors) the validation errors will go away (see Validation_Invalid_but_no_errors.edmx). I would expect this to raise validation errors since the underlying issue is not fixed but this is not the case.
We should investigate this to understand why the validation errors are gone in the last case and if this is correct.
To repro this you can load file in the EFDesigner and do right click-> Validate or use this (easier for debugging):
var edmx = XDocument.Load(@"c:\temp\Validation_Invalid.edmx");
var edmItemCollection = new EdmItemCollection(
edmx
.Descendants("{http://schemas.microsoft.com/ado/2009/11/edm}Schema")
.Select(i => i.CreateReader()));
var storeItemColection = new StoreItemCollection(
edmx
.Descendants("{http://schemas.microsoft.com/ado/2009/11/edm/ssdl}Schema")
.Select(i => i.CreateReader()));
var storeMappingItemCollection = new StorageMappingItemCollection(
edmItemCollection,
storeItemColection,
edmx
.Descendants("{http://schemas.microsoft.com/ado/2009/11/mapping/cs}Mapping")
.Select((i => i.CreateReader())));
var errors = EntityViewGenerator.Validate(storeMappingItemCollection, new Version(3, 0, 0, 0));
Error 1 Error 3036: Problem in mapping fragments starting at lines 180, 186, 196, 206, 211:Mapping fragments cannot be joined. Ensure every mapping fragment maps a key on which it should be joined with one of the other mapping fragments.
The reason for this error is that the EELabelFrozenId property is exposed on the EELabelFrozen entity instead of being mapped to the InfoId property on the Info entity which is its base type. If I map this property correctly the error goes away (see Validation_Fixed.edmx)
However if in the invalid model I delete the RawColumn entity (which is mapped correctly and does not seem to be related to the validation errors) the validation errors will go away (see Validation_Invalid_but_no_errors.edmx). I would expect this to raise validation errors since the underlying issue is not fixed but this is not the case.
We should investigate this to understand why the validation errors are gone in the last case and if this is correct.
To repro this you can load file in the EFDesigner and do right click-> Validate or use this (easier for debugging):
var edmx = XDocument.Load(@"c:\temp\Validation_Invalid.edmx");
var edmItemCollection = new EdmItemCollection(
edmx
.Descendants("{http://schemas.microsoft.com/ado/2009/11/edm}Schema")
.Select(i => i.CreateReader()));
var storeItemColection = new StoreItemCollection(
edmx
.Descendants("{http://schemas.microsoft.com/ado/2009/11/edm/ssdl}Schema")
.Select(i => i.CreateReader()));
var storeMappingItemCollection = new StorageMappingItemCollection(
edmItemCollection,
storeItemColection,
edmx
.Descendants("{http://schemas.microsoft.com/ado/2009/11/mapping/cs}Mapping")
.Select((i => i.CreateReader())));
var errors = EntityViewGenerator.Validate(storeMappingItemCollection, new Version(3, 0, 0, 0));