public StructureProperty(StructurePropertyInfo info, DynamicGetter getter, DynamicSetter setter = null) { _getter = getter; _setter = setter; Parent = info.Parent; Name = info.Name; DataType = info.DataType; IsRootMember = info.Parent == null; IsReadOnly = _setter == null; UniqueMode = info.UniqueMode; var isSimpleOrValueType = DataType.IsSimpleType() || DataType.IsValueType; IsEnumerable = !isSimpleOrValueType && DataType.IsEnumerableType(); IsElement = Parent != null && (Parent.IsElement || Parent.IsEnumerable); ElementDataType = IsEnumerable ? DataType.GetEnumerableElementType() : null; if (IsUnique && !isSimpleOrValueType) { throw new SisoDbException(ExceptionMessages.StructureProperty_Ctor_UniqueOnNonSimpleType); } Path = PropertyPathBuilder.BuildPath(this); }
protected virtual PropertyInfo[] GetEnumerableIndexablePropertyInfos(PropertyInfo[] properties, IStructureProperty parent = null, ICollection <string> nonIndexablePaths = null, ICollection <string> indexablePaths = null) { if (properties.Length == 0) { return(new PropertyInfo[0]); } var filteredProperties = properties.Where(p => !p.PropertyType.IsSimpleType() && p.PropertyType.IsEnumerableType() && !p.PropertyType.IsEnumerableBytesType()); if (nonIndexablePaths != null && nonIndexablePaths.Any()) { filteredProperties = filteredProperties.Where(p => !nonIndexablePaths.Contains( PropertyPathBuilder.BuildPath(parent, p.Name))); } if (indexablePaths != null && indexablePaths.Any()) { filteredProperties = filteredProperties.Where(p => indexablePaths.Contains( PropertyPathBuilder.BuildPath(parent, p.Name))); } return(filteredProperties.ToArray()); }