/// <summary> /// Adds the property info of the dynamic properties to this structural type. /// </summary> /// <param name="propertyInfo">The property being added.</param> public virtual void AddDynamicPropertyDictionary(PropertyInfo propertyInfo) { if (propertyInfo == null) { throw Error.ArgumentNull("propertyInfo"); } if (!typeof(IDictionary <string, object>).IsAssignableFrom(propertyInfo.PropertyType)) { throw Error.Argument("propertyInfo", SRResources.ArgumentMustBeOfType, "IDictionary<string, object>"); } if (!propertyInfo.DeclaringType.IsAssignableFrom(ClrType)) { throw Error.Argument("propertyInfo", SRResources.PropertyDoesNotBelongToType); } // Remove from the ignored properties if (IgnoredProperties.Contains(propertyInfo)) { RemovedProperties.Remove(propertyInfo); } if (_dynamicPropertyDictionary != null) { throw Error.Argument("propertyInfo", SRResources.MoreThanOneDynamicPropertyContainerFound, ClrType.Name); } _dynamicPropertyDictionary = propertyInfo; }
/// <summary> /// Constructor /// </summary> /// <param name="connectionString"></param> /// <param name="ignoredProperties"></param> public EntityWriterConfiguration(string connectionString, IList <Expression <Func <TEntity, object> > > ignoredProperties) : this(connectionString) { foreach (var item in ignoredProperties) { IgnoredProperties.Add(item); } }
/// <summary> /// Adds the property info of the instanceannotation to this structural type. /// </summary> /// <param name="propertyInfo">The property being added.</param> public virtual void AddInstanceAnnotationContainer(PropertyInfo propertyInfo) { if (propertyInfo == null) { throw Error.ArgumentNull("propertyInfo"); } TypeHelper.ValidateAssignableFromForArgument(typeof(IODataInstanceAnnotationContainer), propertyInfo.PropertyType, "IODataInstanceAnnotationContainer"); if (!propertyInfo.DeclaringType.IsAssignableFrom(ClrType)) { throw Error.Argument("propertyInfo", SRResources.PropertyDoesNotBelongToType); } // Remove from the ignored properties if (IgnoredProperties.Contains(propertyInfo)) { RemovedProperties.Remove(propertyInfo); } if (_instanceAnnotationContainer != null) { throw Error.Argument("propertyInfo", SRResources.MoreThanOneAnnotationPropertyContainerFound, ClrType.Name); } _instanceAnnotationContainer = propertyInfo; }
public virtual PrimitivePropertyConfiguration AddProperty(PropertyInfo propertyInfo) { if (propertyInfo == null) { throw Error.ArgumentNull("propertyInfo"); } if (!propertyInfo.DeclaringType.IsAssignableFrom(ClrType)) { throw Error.Argument("propertyInfo", SRResources.PropertyDoesNotBelongToType); } // Remove from the ignored properties if (IgnoredProperties.Contains(propertyInfo)) { IgnoredProperties.Remove(propertyInfo); } PrimitivePropertyConfiguration propertyConfiguration = null; if (ExplicitProperties.ContainsKey(propertyInfo)) { propertyConfiguration = ExplicitProperties[propertyInfo] as PrimitivePropertyConfiguration; if (propertyConfiguration == null) { throw Error.Argument("propertyInfo", SRResources.MustBePrimitiveProperty, propertyInfo.Name); } } else { propertyConfiguration = new PrimitivePropertyConfiguration(propertyInfo); ExplicitProperties[propertyInfo] = propertyConfiguration; } return(propertyConfiguration); }
/// <summary> /// Adds a collection property to this edm type. /// </summary> /// <param name="propertyInfo">The property being added.</param> /// <returns>The <see cref="CollectionPropertyConfiguration"/> so that the property can be configured further.</returns> public virtual CollectionPropertyConfiguration AddCollectionProperty(PropertyInfo propertyInfo) { if (propertyInfo == null) { throw Error.ArgumentNull("propertyInfo"); } if (!propertyInfo.DeclaringType.IsAssignableFrom(ClrType)) { throw Error.Argument("propertyInfo", SRResources.PropertyDoesNotBelongToType); } ValidatePropertyNotAlreadyDefinedInBaseTypes(propertyInfo); ValidatePropertyNotAlreadyDefinedInDerivedTypes(propertyInfo); // Remove from the ignored properties if (IgnoredProperties.Contains(propertyInfo)) { RemovedProperties.Remove(propertyInfo); } CollectionPropertyConfiguration propertyConfiguration; if (ExplicitProperties.ContainsKey(propertyInfo)) { propertyConfiguration = ExplicitProperties[propertyInfo] as CollectionPropertyConfiguration; if (propertyConfiguration == null) { throw Error.Argument("propertyInfo", SRResources.MustBeCollectionProperty, propertyInfo.Name, propertyInfo.DeclaringType.FullName); } } else { propertyConfiguration = new CollectionPropertyConfiguration(propertyInfo, this); ExplicitProperties[propertyInfo] = propertyConfiguration; // If the ElementType is the same as this type this is recursive complex type nesting if (propertyConfiguration.ElementType == ClrType) { throw Error.Argument("propertyInfo", SRResources.RecursiveComplexTypesNotAllowed, ClrType.Name, propertyConfiguration.Name); } // If the ElementType is not primitive or enum treat as a ComplexType and Add to the model. IEdmPrimitiveTypeReference edmType = EdmLibHelpers.GetEdmPrimitiveTypeReferenceOrNull(propertyConfiguration.ElementType); if (edmType == null) { if (!TypeHelper.IsEnum(propertyConfiguration.ElementType)) { ModelBuilder.AddComplexType(propertyConfiguration.ElementType); } } } return(propertyConfiguration); }
public TableExporter <T> Ignore(IEnumerable <string> propertyNames) { foreach (var propName in propertyNames) { IgnoredProperties.Add(propName); } return(this); }
public TableExporter <T> Ignore <TProperty>(Expression <Func <T, TProperty> > property) { foreach (var propName in PropertyNames.For(property)) { IgnoredProperties.Add(propName); } return(this); }
public bool IsPropertyIgnored(string propName) { if (!propIgnored) { return(false); } else { return(IgnoredProperties.Contains(propName)); } }
protected override JsonProperty CreateProperty(MemberInfo member, MemberSerialization memberSerialization) { JsonProperty property = base.CreateProperty(member, memberSerialization); if (!IgnoredProperties.Contains(member.Name)) { property.Ignored = !DocProcessingInstructionProperties.Contains(property.PropertyName); } property.ShouldSerialize = instance => !property.Ignored; return(property); }
public void Enrich(LogEvent logEvent, ILogEventPropertyFactory propertyFactory) { foreach (var property in AllProperties) { if (IgnoredProperties.Contains(property.Key)) { continue; } var destructureObjects = PropertiesToDestructure.Contains(property.Key); logEvent.AddPropertyIfAbsent(propertyFactory.CreateProperty(property.Key, property.Value, destructureObjects)); } }
public virtual ComplexPropertyConfiguration AddComplexProperty(PropertyInfo propertyInfo) { if (propertyInfo == null) { throw Error.ArgumentNull("propertyInfo"); } if (!propertyInfo.DeclaringType.IsAssignableFrom(ClrType)) { throw Error.Argument("propertyInfo", SRResources.PropertyDoesNotBelongToType); } if (propertyInfo.PropertyType == ClrType) { throw Error.Argument("propertyInfo", SRResources.RecursiveComplexTypesNotAllowed); } // Remove from the ignored properties if (IgnoredProperties.Contains(propertyInfo)) { IgnoredProperties.Remove(propertyInfo); } ComplexPropertyConfiguration propertyConfiguration = null; if (ExplicitProperties.ContainsKey(propertyInfo)) { propertyConfiguration = ExplicitProperties[propertyInfo] as ComplexPropertyConfiguration; if (propertyConfiguration == null) { throw Error.Argument("propertyInfo", SRResources.MustBeComplexProperty, propertyInfo.Name); } } else { propertyConfiguration = new ComplexPropertyConfiguration(propertyInfo); ExplicitProperties[propertyInfo] = propertyConfiguration; // Make sure the complex type is in the model. ModelBuilder.AddComplexType(propertyInfo.PropertyType); } return(propertyConfiguration); }
public virtual void RemoveProperty(PropertyInfo propertyInfo) { if (propertyInfo == null) { throw Error.ArgumentNull("propertyInfo"); } if (!propertyInfo.DeclaringType.IsAssignableFrom(ClrType)) { throw Error.Argument("propertyInfo", SRResources.PropertyDoesNotBelongToType); } if (ExplicitProperties.ContainsKey(propertyInfo)) { ExplicitProperties.Remove(propertyInfo); } if (!IgnoredProperties.Contains(propertyInfo)) { IgnoredProperties.Add(propertyInfo); } }
/// <summary> /// Adds the property info of the dynamic properties to this structural type. /// </summary> /// <param name="propertyInfo">The property being added.</param> public virtual void AddDynamicPropertyDictionary(PropertyInfo propertyInfo) { if (propertyInfo == null) { throw Error.ArgumentNull("propertyInfo"); } if (!typeof(IDictionary <string, object>).IsAssignableFrom(propertyInfo.PropertyType)) { throw Error.Argument("propertyInfo", SRResources.ArgumentMustBeOfType, "IDictionary<string, object>"); } if (!propertyInfo.DeclaringType.IsAssignableFrom(ClrType)) { throw Error.Argument("propertyInfo", SRResources.PropertyDoesNotBelongToType); } // Throws NotSupported exception if attempting to add a dynamic property dictionary property // on open entity type. Please remove this block after supporting the open entity type. if (Kind == EdmTypeKind.Entity) { throw Error.NotSupported(SRResources.OpenEntityTypeNotSupported, propertyInfo.Name, Name); } // Remove from the ignored properties if (IgnoredProperties.Contains(propertyInfo)) { RemovedProperties.Remove(propertyInfo); } if (_dynamicPropertyDictionary != null) { throw Error.Argument("propertyInfo", SRResources.MoreThanOneDynamicPropertyContainerFound, ClrType.Name); } _dynamicPropertyDictionary = propertyInfo; }
private bool ignoreProperty(MemberInfo property) { return(IgnoredProperties.Contains(property.Name)); }
public static bool HasAllEmptyProperties(Candidate candidate) { var type = typeof(Candidate); var properties = type.GetProperties(BindingFlags.Public | BindingFlags.Instance).Where(prop => !IgnoredProperties.Contains(prop.Name)); var hasProperty = properties.Any(x => x.GetValue(candidate, null).IsNullOrEmpty()); return(!hasProperty); }
public static List <string> GetIncompleteCandidateDetails(this Candidate candidate) { var type = typeof(Candidate); var properties = type.GetProperties(BindingFlags.Public | BindingFlags.Instance).Where(prop => !IgnoredProperties.Contains(prop.Name)); var nullProperties = properties.Where(prop => prop.GetValue(candidate, null).IsNullOrEmpty()) .Select(property => property.Name); return(nullProperties.ToList()); }
/// <summary> /// Constructor /// </summary> /// <param name="connectionString"></param> /// <param name="ignoredProperty"></param> public EntityWriterConfiguration(string connectionString, Expression <Func <TEntity, object> > ignoredProperty) : this(connectionString) { IgnoredProperties.Add(ignoredProperty); }
/// <summary> /// Returns true if OrgApacheJackrabbitOakPluginsIndexSolrOsgiOakSolrConfigurationProperties instances are equal /// </summary> /// <param name="other">Instance of OrgApacheJackrabbitOakPluginsIndexSolrOsgiOakSolrConfigurationProperties to be compared</param> /// <returns>Boolean</returns> public bool Equals(OrgApacheJackrabbitOakPluginsIndexSolrOsgiOakSolrConfigurationProperties other) { if (other is null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( PathDescField == other.PathDescField || PathDescField != null && PathDescField.Equals(other.PathDescField) ) && ( PathChildField == other.PathChildField || PathChildField != null && PathChildField.Equals(other.PathChildField) ) && ( PathParentField == other.PathParentField || PathParentField != null && PathParentField.Equals(other.PathParentField) ) && ( PathExactField == other.PathExactField || PathExactField != null && PathExactField.Equals(other.PathExactField) ) && ( CatchAllField == other.CatchAllField || CatchAllField != null && CatchAllField.Equals(other.CatchAllField) ) && ( CollapsedPathField == other.CollapsedPathField || CollapsedPathField != null && CollapsedPathField.Equals(other.CollapsedPathField) ) && ( PathDepthField == other.PathDepthField || PathDepthField != null && PathDepthField.Equals(other.PathDepthField) ) && ( CommitPolicy == other.CommitPolicy || CommitPolicy != null && CommitPolicy.Equals(other.CommitPolicy) ) && ( Rows == other.Rows || Rows != null && Rows.Equals(other.Rows) ) && ( PathRestrictions == other.PathRestrictions || PathRestrictions != null && PathRestrictions.Equals(other.PathRestrictions) ) && ( PropertyRestrictions == other.PropertyRestrictions || PropertyRestrictions != null && PropertyRestrictions.Equals(other.PropertyRestrictions) ) && ( PrimarytypesRestrictions == other.PrimarytypesRestrictions || PrimarytypesRestrictions != null && PrimarytypesRestrictions.Equals(other.PrimarytypesRestrictions) ) && ( IgnoredProperties == other.IgnoredProperties || IgnoredProperties != null && IgnoredProperties.Equals(other.IgnoredProperties) ) && ( UsedProperties == other.UsedProperties || UsedProperties != null && UsedProperties.Equals(other.UsedProperties) ) && ( TypeMappings == other.TypeMappings || TypeMappings != null && TypeMappings.Equals(other.TypeMappings) ) && ( PropertyMappings == other.PropertyMappings || PropertyMappings != null && PropertyMappings.Equals(other.PropertyMappings) ) && ( CollapseJcrcontentNodes == other.CollapseJcrcontentNodes || CollapseJcrcontentNodes != null && CollapseJcrcontentNodes.Equals(other.CollapseJcrcontentNodes) )); }
/// <summary> /// Specify a property to be ignored from a object being merged. /// </summary> /// <param name="ignoreProperty">The property of the object to be ignored as a Func.</param> /// <returns>TypeMerger policy used in method chaining.</returns> public xTypeMergerPolicy Ignore(Expression <Func <object> > ignoreProperty) { IgnoredProperties.Add(GetObjectTypeAndProperty(ignoreProperty)); return(this); }
/// <summary> /// Constructor /// </summary> /// <param name="connectionString"></param> /// <param name="ignoredProperty"></param> public ValueReaderConfiguration(string connectionString, Expression <Func <TValue, object> > ignoredProperty) : this(connectionString) { IgnoredProperties.Add(ignoredProperty); }
public void IgnoreProperty <TProp>(Expression <Func <TClass, TProp> > expression) { var propInfo = TypeHelpers.GetPropertyInfo(expression); IgnoredProperties.Add(BuilderUtils.GetKey(propInfo)); }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { var hashCode = 41; // Suitable nullity checks etc, of course :) if (PathDescField != null) { hashCode = hashCode * 59 + PathDescField.GetHashCode(); } if (PathChildField != null) { hashCode = hashCode * 59 + PathChildField.GetHashCode(); } if (PathParentField != null) { hashCode = hashCode * 59 + PathParentField.GetHashCode(); } if (PathExactField != null) { hashCode = hashCode * 59 + PathExactField.GetHashCode(); } if (CatchAllField != null) { hashCode = hashCode * 59 + CatchAllField.GetHashCode(); } if (CollapsedPathField != null) { hashCode = hashCode * 59 + CollapsedPathField.GetHashCode(); } if (PathDepthField != null) { hashCode = hashCode * 59 + PathDepthField.GetHashCode(); } if (CommitPolicy != null) { hashCode = hashCode * 59 + CommitPolicy.GetHashCode(); } if (Rows != null) { hashCode = hashCode * 59 + Rows.GetHashCode(); } if (PathRestrictions != null) { hashCode = hashCode * 59 + PathRestrictions.GetHashCode(); } if (PropertyRestrictions != null) { hashCode = hashCode * 59 + PropertyRestrictions.GetHashCode(); } if (PrimarytypesRestrictions != null) { hashCode = hashCode * 59 + PrimarytypesRestrictions.GetHashCode(); } if (IgnoredProperties != null) { hashCode = hashCode * 59 + IgnoredProperties.GetHashCode(); } if (UsedProperties != null) { hashCode = hashCode * 59 + UsedProperties.GetHashCode(); } if (TypeMappings != null) { hashCode = hashCode * 59 + TypeMappings.GetHashCode(); } if (PropertyMappings != null) { hashCode = hashCode * 59 + PropertyMappings.GetHashCode(); } if (CollapseJcrcontentNodes != null) { hashCode = hashCode * 59 + CollapseJcrcontentNodes.GetHashCode(); } return(hashCode); } }