コード例 #1
0
        // remove the base type properties from the derived types.
        internal void RemoveBaseTypeProperties(StructuralTypeConfiguration derivedStructrualType,
                                               StructuralTypeConfiguration baseStructuralType)
        {
            IEnumerable <StructuralTypeConfiguration> typesToLift = new[] { derivedStructrualType }
            .Concat(this.DerivedTypes(derivedStructrualType));

            foreach (PropertyConfiguration property in baseStructuralType.Properties
                     .Concat(baseStructuralType.DerivedProperties()))
            {
                foreach (StructuralTypeConfiguration structuralType in typesToLift)
                {
                    PropertyConfiguration derivedPropertyToRemove = structuralType.Properties.SingleOrDefault(
                        p => p.PropertyInfo.Name == property.PropertyInfo.Name);
                    if (derivedPropertyToRemove != null)
                    {
                        structuralType.RemoveProperty(derivedPropertyToRemove.PropertyInfo);
                    }
                }
            }

            foreach (PropertyInfo ignoredProperty in baseStructuralType.IgnoredProperties())
            {
                foreach (StructuralTypeConfiguration structuralType in typesToLift)
                {
                    PropertyConfiguration derivedPropertyToRemove = structuralType.Properties.SingleOrDefault(
                        p => p.PropertyInfo.Name == ignoredProperty.Name);
                    if (derivedPropertyToRemove != null)
                    {
                        structuralType.RemoveProperty(derivedPropertyToRemove.PropertyInfo);
                    }
                }
            }
        }
コード例 #2
0
 private void ReapplyPropertyConvention(PropertyConfiguration property,
                                        StructuralTypeConfiguration edmTypeConfiguration)
 {
     foreach (IEdmPropertyConvention propertyConvention in _conventions.OfType <IEdmPropertyConvention>())
     {
         propertyConvention.Apply(property, edmTypeConfiguration, this);
     }
 }
コード例 #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="QueryableRestrictions"/> class.
 /// </summary>
 /// <param name="propertyConfiguration">The PropertyConfiguration containing queryable restrictions.</param>
 public QueryableRestrictions(PropertyConfiguration propertyConfiguration)
 {
     NotFilterable = propertyConfiguration.NotFilterable;
     NotSortable = propertyConfiguration.NotSortable;
     NotNavigable = propertyConfiguration.NotNavigable;
     NotExpandable = propertyConfiguration.NotExpandable;
     NotCountable = propertyConfiguration.NotCountable;
 }
コード例 #4
0
        internal void ValidatePropertyNotAlreadyDefinedInBaseTypes(PropertyInfo propertyInfo)
        {
            PropertyConfiguration baseProperty =
                this.DerivedProperties().FirstOrDefault(p => p.Name == propertyInfo.Name);

            if (baseProperty != null)
            {
                throw Error.Argument("propertyInfo", SRResources.CannotRedefineBaseTypeProperty,
                                     propertyInfo.Name, baseProperty.PropertyInfo.DeclaringType.FullName);
            }
        }
コード例 #5
0
 internal void ValidatePropertyNotAlreadyDefinedInDerivedTypes(PropertyInfo propertyInfo)
 {
     foreach (StructuralTypeConfiguration derivedType in ModelBuilder.DerivedTypes(this))
     {
         PropertyConfiguration propertyInDerivedType =
             derivedType.Properties.FirstOrDefault(p => p.Name == propertyInfo.Name);
         if (propertyInDerivedType != null)
         {
             throw Error.Argument("propertyInfo", SRResources.PropertyAlreadyDefinedInDerivedType,
                                  propertyInfo.Name, FullName, derivedType.FullName);
         }
     }
 }
コード例 #6
0
        private bool ShouldApplyLowerCamelCase(PropertyConfiguration property)
        {
            if (property.AddedExplicitly)
            {
                return(_options.HasFlag(NameResolverOptions.ProcessExplicitPropertyNames));
            }
            else
            {
                DataMemberAttribute attribute = property.PropertyInfo.GetCustomAttribute <DataMemberAttribute>(inherit: false);

                if (attribute != null && !String.IsNullOrWhiteSpace(attribute.Name))
                {
                    return(_options.HasFlag(NameResolverOptions.ProcessDataMemberAttributePropertyNames));
                }

                return(_options.HasFlag(NameResolverOptions.ProcessReflectedPropertyNames));
            }
        }
コード例 #7
0
ファイル: LowerCamelCaser.cs プロジェクト: joshcomley/WebApi
        private bool ShouldApplyLowerCamelCase(PropertyConfiguration property)
        {
            if (property.AddedExplicitly)
            {
                return _options.HasFlag(NameResolverOptions.ProcessExplicitPropertyNames);
            }
            else
            {
                DataMemberAttribute attribute = property.PropertyInfo.GetCustomAttribute<DataMemberAttribute>(inherit: false);

                if (attribute != null && !String.IsNullOrWhiteSpace(attribute.Name))
                {
                    return _options.HasFlag(NameResolverOptions.ProcessDataMemberAttributePropertyNames);
                }

                return _options.HasFlag(NameResolverOptions.ProcessReflectedPropertyNames);
            }
        }