/// <summary> /// Removes the property from the edm type. /// </summary> /// <param name="edmProperty">The property being removed.</param> /// <param name="structuralTypeConfiguration">The edm type from which the property is being removed.</param> /// <param name="attribute">The <see cref="Attribute"/> found on this type.</param> public override void Apply(PropertyConfiguration edmProperty, StructuralTypeConfiguration structuralTypeConfiguration, Attribute attribute) { if (structuralTypeConfiguration == null) { throw Error.ArgumentNull("structuralTypeConfiguration"); } if (edmProperty == null) { throw Error.ArgumentNull("edmProperty"); } if (!edmProperty.AddedExplicitly) { bool isTypeDataContract = structuralTypeConfiguration.ClrType.GetCustomAttributes(typeof(DataContractAttribute), inherit: true).Any(); bool isPropertyDataMember = edmProperty.PropertyInfo.GetCustomAttributes(typeof(DataMemberAttribute), inherit: true).Any(); if (isTypeDataContract && isPropertyDataMember) { // both Datamember and IgnoreDataMember. DataMember wins as this a DataContract return; } else { structuralTypeConfiguration.RemoveProperty(edmProperty.PropertyInfo); } } }
public override void Apply(PropertyConfiguration edmProperty, StructuralTypeConfiguration structuralTypeConfiguration, Attribute attribute) { if (edmProperty == null) { throw Error.ArgumentNull("edmProperty"); } if (structuralTypeConfiguration == null) { throw Error.ArgumentNull("structuralTypeConfiguration"); } structuralTypeConfiguration.RemoveProperty(edmProperty.PropertyInfo); }
public override void Apply(PropertyConfiguration edmProperty, StructuralTypeConfiguration structuralTypeConfiguration, Attribute attribute, ODataConventionModelBuilder model) { if (edmProperty == null) { throw Error.ArgumentNull("edmProperty"); } if (structuralTypeConfiguration == null) { throw Error.ArgumentNull("structuralTypeConfiguration"); } if (!edmProperty.AddedExplicitly) { structuralTypeConfiguration.RemoveProperty(edmProperty.PropertyInfo); } }