public PropertyMetaInformation Build(PropertyInfo propertyInfo, Type typeInfo) { var result = new PropertyMetaInformation { Name = propertyInfo.Name, }; if (propertyInfo.CustomAttributes.Any(x => x.AttributeType == typeof(TPrimaryKey))) { result.IsSearchable = true; result.IsIdentity = true; result.IsSortable = true; result.AvailableFilters = specialTypes.Contains(propertyInfo.PropertyType) ? new[] { ObjectFieldFilterOperator.Equals, ObjectFieldFilterOperator.DoesNotEqual } : defaultFilters; } if (propertyInfo.CustomAttributes.Any(x => x.AttributeType == typeof(TIndex))) { result.IsSearchable = true; result.IsSortable = true; result.AvailableFilters = specialTypes.Contains(propertyInfo.PropertyType) ? new[] { ObjectFieldFilterOperator.Equals, ObjectFieldFilterOperator.DoesNotEqual } : defaultFilters; } return(result); }
public PropertyMetaInformation Build(PropertyInfo propertyInfo, Type typeInfo) { var result = new PropertyMetaInformation { Name = propertyInfo.Name, }; var indexed = propertyInfo.GetCustomAttribute(typeof(IndexedAttribute)) != null; var required = propertyInfo.GetCustomAttribute(typeof(RequiredAttribute)) != null; var identity = propertyInfo.GetCustomAttribute(typeof(IdentityAttribute)) != null; var sortable = propertyInfo.GetCustomAttribute(typeof(SortableAttribute)) != null; if (indexed || required) { result.IsSearchable = true; result.AvailableFilters = availableFilters[typeInfo]; if (required) { result.IsRequired = true; } } if (sortable) { result.IsSortable = true; } if (identity) { result.IsIdentity = true; } return(result); }
public PropertyMetaInformation Build(PropertyInfo propertyInfo, Type typeInfo) { var result = new PropertyMetaInformation { Name = propertyInfo.Name, }; if (propertyInfo.CustomAttributes.Any(x => x.AttributeType == typeof(PartitionKeyAttribute))) { result.IsSearchable = true; result.IsIdentity = true; result.IsRequired = true; result.AvailableFilters = new[] { ObjectFieldFilterOperator.Equals }; } if (propertyInfo.CustomAttributes.Any(x => x.AttributeType == typeof(ClusteringKeyAttribute))) { result.IsSearchable = true; result.IsIdentity = true; result.IsSortable = true; result.AvailableFilters = specialTypes.Contains(propertyInfo.PropertyType) ? new[] { ObjectFieldFilterOperator.Equals } : defaultFilters; } return(result); }