Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix Entity_ComplextType_WhereComplexTypeIsLastProperty
  • Loading branch information
pluskal committed Jan 19, 2017
commit e5e72c0738c81dd6b80c7464e645bb6c401d3f40
15 changes: 11 additions & 4 deletions EntityFramework.MappingAPI/Mappers/MapperBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,8 @@ public EntityMap MapEntity(string typeFullName, EdmType edmItem)
// |
// C - N3,P6ref
// Mapping B it mixes doscriminator with N1 ...
var propertiesToMap = entityMap.IsTph ? storageEntitySet.ElementType.Properties.Take(storageEntitySet.ElementType.Properties.Count - 1) : GetPropertiesToMap(entityMap, storageEntitySet.ElementType.Properties);
var propertiesToMap = GetPropertiesToMap(entityMap, storageEntitySet.ElementType.Properties);
//var propertiesToMap = entityMap.IsTph ? storageEntitySet.ElementType.Properties.Take(storageEntitySet.ElementType.Properties.Count - 1) : GetPropertiesToMap(entityMap, storageEntitySet.ElementType.Properties);

foreach (var edmProperty in propertiesToMap)
{
Expand Down Expand Up @@ -460,11 +461,17 @@ private void MapProperty(EntityMap entityMap, EdmProperty edmProperty, ref int i
var entityMembers = TphData[identity].Properties;
var columnName = edmProperty.Name;

if (entityMembers.Length <= i)
EdmMember edmMember;
if(entityMembers.Length <= i)
{
return;
if(prefix != null) { edmMember = entityMembers[i-1]; }
else
{ return; }
}
else
{
edmMember = entityMembers[i];
}
EdmMember edmMember = entityMembers[i];

// check if is complex type
if (string.IsNullOrEmpty(prefix) && edmMember.TypeUsage.EdmType.GetType() == typeof(ComplexType))
Expand Down