private static DbExpression GenerateStructuralTypeMappingView( StructuralType structuralType, List <PropertyMapping> propertyMappings, DbExpression row) { List <DbExpression> dbExpressionList = new List <DbExpression>(TypeHelpers.GetAllStructuralMembers((EdmType)structuralType).Count); for (int index = 0; index < propertyMappings.Count; ++index) { PropertyMapping propertyMapping = propertyMappings[index]; dbExpressionList.Add(FunctionImportMappingComposable.GeneratePropertyMappingView(propertyMapping, row)); } return((DbExpression)TypeUsage.Create((EdmType)structuralType).New((IEnumerable <DbExpression>)dbExpressionList)); }
protected virtual void Visit(PropertyMapping propertyMapping) { if (propertyMapping.GetType() == typeof(ComplexPropertyMapping)) { this.Visit((ComplexPropertyMapping)propertyMapping); } else if (propertyMapping.GetType() == typeof(ConditionPropertyMapping)) { this.Visit((ConditionPropertyMapping)propertyMapping); } else { if (!(propertyMapping.GetType() == typeof(ScalarPropertyMapping))) { return; } this.Visit((ScalarPropertyMapping)propertyMapping); } }
public static string GetIdentity(PropertyMapping mapping) { ScalarPropertyMapping mapping1 = mapping as ScalarPropertyMapping; if (mapping1 != null) { return(BaseMetadataMappingVisitor.IdentityHelper.GetIdentity(mapping1)); } ComplexPropertyMapping mapping2 = mapping as ComplexPropertyMapping; if (mapping2 != null) { return(BaseMetadataMappingVisitor.IdentityHelper.GetIdentity(mapping2)); } EndPropertyMapping mapping3 = mapping as EndPropertyMapping; if (mapping3 != null) { return(BaseMetadataMappingVisitor.IdentityHelper.GetIdentity(mapping3)); } return(BaseMetadataMappingVisitor.IdentityHelper.GetIdentity((ConditionPropertyMapping)mapping)); }
private static void RemoveColumnMapping( StructuralTypeMapping structuralTypeMapping, IEnumerable <EdmProperty> propertyPath) { PropertyMapping propertyMapping = structuralTypeMapping.PropertyMappings.Single <PropertyMapping>((Func <PropertyMapping, bool>)(pm => object.ReferenceEquals((object)pm.Property, (object)propertyPath.First <EdmProperty>()))); if (propertyMapping is ScalarPropertyMapping) { structuralTypeMapping.RemovePropertyMapping(propertyMapping); } else { ComplexPropertyMapping complexPropertyMapping = (ComplexPropertyMapping)propertyMapping; ComplexTypeMapping complexTypeMapping = complexPropertyMapping.TypeMappings.Single <ComplexTypeMapping>(); MappingFragment.RemoveColumnMapping((StructuralTypeMapping)complexTypeMapping, propertyPath.Skip <EdmProperty>(1)); if (complexTypeMapping.PropertyMappings.Any <PropertyMapping>()) { return; } structuralTypeMapping.RemovePropertyMapping((PropertyMapping)complexPropertyMapping); } }
private static DbExpression GeneratePropertyMappingView(PropertyMapping mapping, DbExpression row) { var scalarPropertyMapping = (ScalarPropertyMapping)mapping; return(GenerateScalarPropertyMappingView(scalarPropertyMapping.Property, scalarPropertyMapping.Column, row)); }
protected override void Visit(PropertyMapping propertyMapping) { base.Visit(propertyMapping); }
/// <summary>Removes a property mapping.</summary> /// <param name="propertyMapping">The property mapping to be removed.</param> public override void RemovePropertyMapping(PropertyMapping propertyMapping) { Check.NotNull <PropertyMapping>(propertyMapping, nameof(propertyMapping)); this.ThrowIfReadOnly(); this.m_properties.Remove(propertyMapping.Property.Name); }
/// <summary> /// Removes a property mapping. /// </summary> /// <param name="propertyMapping">The property mapping to be removed.</param> public abstract void RemovePropertyMapping(PropertyMapping propertyMapping);
/// <summary> /// Adds a property mapping. /// </summary> /// <param name="propertyMapping">The property mapping to be added.</param> public abstract void AddPropertyMapping(PropertyMapping propertyMapping);
/// <summary>Adds a property mapping.</summary> /// <param name="propertyMapping">The property mapping to be added.</param> public override void AddPropertyMapping(PropertyMapping propertyMapping) { Check.NotNull <PropertyMapping>(propertyMapping, nameof(propertyMapping)); this.ThrowIfReadOnly(); this.m_properties.Add(propertyMapping); }