コード例 #1
0
        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));
        }
コード例 #2
0
 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);
     }
 }
コード例 #3
0
            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));
            }
コード例 #4
0
        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));
        }
コード例 #6
0
 protected override void Visit(PropertyMapping propertyMapping)
 {
     base.Visit(propertyMapping);
 }
コード例 #7
0
 /// <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);
 }
コード例 #8
0
 /// <summary>
 /// Removes a property mapping.
 /// </summary>
 /// <param name="propertyMapping">The property mapping to be removed.</param>
 public abstract void RemovePropertyMapping(PropertyMapping propertyMapping);
コード例 #9
0
 /// <summary>
 /// Adds a property mapping.
 /// </summary>
 /// <param name="propertyMapping">The property mapping to be added.</param>
 public abstract void AddPropertyMapping(PropertyMapping propertyMapping);
コード例 #10
0
 /// <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);
 }