private static void Validate(EpmSourcePathSegment pathSegment, ClientTypeAnnotation resourceType) { foreach (EpmSourcePathSegment segment in pathSegment.SubProperties) { ClientTypeAnnotation propertyType = GetPropertyType(resourceType, segment.PropertyName); Validate(segment, propertyType); } }
internal void Add(EntityPropertyMappingInfo epmInfo) { EpmSourcePathSegment root = this.Root; EpmSourcePathSegment segment2 = null; ClientTypeAnnotation actualPropertyType = epmInfo.ActualPropertyType; for (int i = 0; i < epmInfo.PropertyValuePath.Length; i++) { string propertyName = epmInfo.PropertyValuePath[i]; if (propertyName.Length == 0) { throw new InvalidOperationException(System.Data.Services.Client.Strings.EpmSourceTree_InvalidSourcePath(epmInfo.DefiningType.Name, epmInfo.Attribute.SourcePath)); } actualPropertyType = GetPropertyType(actualPropertyType, propertyName); segment2 = root.SubProperties.SingleOrDefault <EpmSourcePathSegment>(e => e.PropertyName == propertyName); if (segment2 != null) { root = segment2; } else { EpmSourcePathSegment item = new EpmSourcePathSegment(propertyName); root.SubProperties.Add(item); root = item; } } if ((actualPropertyType != null) && !PrimitiveType.IsKnownNullableType(actualPropertyType.ElementType)) { throw new InvalidOperationException(System.Data.Services.Client.Strings.EpmSourceTree_EndsWithNonPrimitiveType(root.PropertyName)); } if (segment2 != null) { if (segment2.EpmInfo.DefiningTypesAreEqual(epmInfo)) { throw new InvalidOperationException(System.Data.Services.Client.Strings.EpmSourceTree_DuplicateEpmAttrsWithSameSourceName(epmInfo.Attribute.SourcePath, epmInfo.DefiningType.Name)); } this.epmTargetTree.Remove(segment2.EpmInfo); } root.EpmInfo = epmInfo; this.epmTargetTree.Add(epmInfo); }
internal void Add(EntityPropertyMappingInfo epmInfo) { EpmSourcePathSegment root = this.Root; EpmSourcePathSegment segment2 = null; ClientTypeAnnotation actualPropertyType = epmInfo.ActualPropertyType; for (int i = 0; i < epmInfo.PropertyValuePath.Length; i++) { string propertyName = epmInfo.PropertyValuePath[i]; if (propertyName.Length == 0) { throw new InvalidOperationException(System.Data.Services.Client.Strings.EpmSourceTree_InvalidSourcePath(epmInfo.DefiningType.Name, epmInfo.Attribute.SourcePath)); } actualPropertyType = GetPropertyType(actualPropertyType, propertyName); segment2 = root.SubProperties.SingleOrDefault<EpmSourcePathSegment>(e => e.PropertyName == propertyName); if (segment2 != null) { root = segment2; } else { EpmSourcePathSegment item = new EpmSourcePathSegment(propertyName); root.SubProperties.Add(item); root = item; } } if ((actualPropertyType != null) && !PrimitiveType.IsKnownNullableType(actualPropertyType.ElementType)) { throw new InvalidOperationException(System.Data.Services.Client.Strings.EpmSourceTree_EndsWithNonPrimitiveType(root.PropertyName)); } if (segment2 != null) { if (segment2.EpmInfo.DefiningTypesAreEqual(epmInfo)) { throw new InvalidOperationException(System.Data.Services.Client.Strings.EpmSourceTree_DuplicateEpmAttrsWithSameSourceName(epmInfo.Attribute.SourcePath, epmInfo.DefiningType.Name)); } this.epmTargetTree.Remove(segment2.EpmInfo); } root.EpmInfo = epmInfo; this.epmTargetTree.Add(epmInfo); }