// 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); } } } }
/// <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; }
private void ReapplyPropertyConvention(PropertyConfiguration property, StructuralTypeConfiguration edmTypeConfiguration) { foreach (IEdmPropertyConvention propertyConvention in _conventions.OfType <IEdmPropertyConvention>()) { propertyConvention.Apply(property, edmTypeConfiguration, this); } }
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, TypeHelper.GetReflectedType(baseProperty.PropertyInfo).FullName); } }
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); } } }
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)); } }
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); } }
private void AddExplicitProperty(PropertyInfo propertyInfo, PropertyConfiguration propertyConfiguration) { ExplicitProperties[propertyInfo] = propertyConfiguration; this.explicitPropertyNames.Add(propertyConfiguration.Name); }