/// <summary> /// Gets the state that determines this date-time attribute is be stored as string with date and time or not /// </summary> /// <param name="attribute"></param> /// <returns></returns> public static bool IsStoredAsDateTimeString(this ObjectService.AttributeInfo attribute) => attribute != null && attribute.IsStoredAsString() && attribute.GetCustomAttribute <AsStringAttribute>().AllowTime;
/// <summary> /// Gets the state that determines this object attribute is be stored as JSON or not /// </summary> /// <param name="attribute"></param> /// <returns></returns> public static bool IsStoredAsJson(this ObjectService.AttributeInfo attribute) => attribute != null && attribute.IsClassType() && attribute.GetCustomAttribute <AsJsonAttribute>() != null;
/// <summary> /// Gets the state that determines this attribute is view control or not /// </summary> /// <param name="attribute"></param> /// <returns></returns> public static bool IsViewControl(this ObjectService.AttributeInfo attribute) => attribute != null && attribute.IsFormControl() && attribute.GetCustomAttribute <FormControlAttribute>().AsViewControl;
/// <summary> /// Gets the state that determines this attribute is enum-string or not /// </summary> /// <param name="attribute"></param> /// <returns></returns> public static bool IsEnumString(this ObjectService.AttributeInfo attribute) => attribute != null && attribute.IsEnum() && typeof(Newtonsoft.Json.Converters.StringEnumConverter).Equals(attribute.GetCustomAttribute <JsonConverterAttribute>()?.ConverterType);
/// <summary> /// Gets the state that determines this attribute is 'pre-defined' full-text index and able to search or not /// </summary> /// <param name="attribute"></param> /// <returns></returns> public static bool IsSearchable(this ObjectService.AttributeInfo attribute) => attribute != null && attribute.IsStringType() && attribute.GetCustomAttribute <SearchableAttribute>() != null;
/// <summary> /// Gets the state that determines this attribute is form control or not /// </summary> /// <param name="attribute"></param> /// <returns></returns> public static bool IsFormControl(this ObjectService.AttributeInfo attribute) => attribute?.GetCustomAttribute <FormControlAttribute>() != null;
/// <summary> /// Gets the state that determines this property is mapping identities of a children objects /// </summary> /// <param name="attribute"></param> /// <returns></returns> public static bool IsChildrenMappings(this ObjectService.AttributeInfo attribute) => attribute?.GetCustomAttribute <ChildrenMappingsAttribute>() != null;
/// <summary> /// Gets the state that determines this attribute is sortable or not /// </summary> /// <param name="attribute"></param> /// <returns></returns> public static bool IsSortable(this ObjectService.AttributeInfo attribute) => attribute?.GetCustomAttribute <SortableAttribute>() != null;
/// <summary> /// Gets the state that determines this property is mapping identities of a parent objects /// </summary> /// <param name="attribute"></param> /// <returns></returns> public static bool IsMultipleParentMappings(this ObjectService.AttributeInfo attribute) => attribute?.GetCustomAttribute <MultipleParentMappingsAttribute>() != null;
/// <summary> /// Gets the state that determines this property is mapping identity of a parent object /// </summary> /// <param name="attribute"></param> /// <returns></returns> public static bool IsParentMapping(this ObjectService.AttributeInfo attribute) => attribute?.GetCustomAttribute <ParentMappingAttribute>() != null;
/// <summary> /// Gets the state that determines this property is mark as alias /// </summary> /// <param name="attribute"></param> /// <returns></returns> public static bool IsAlias(this ObjectService.AttributeInfo attribute) => attribute?.GetCustomAttribute <AliasAttribute>() != null;
/// <summary> /// Gets the state that determines this attribute is be ignored if value is null or not /// </summary> /// <param name="attribute"></param> /// <returns></returns> public static bool IsIgnoredIfNull(this ObjectService.AttributeInfo attribute) => attribute?.GetCustomAttribute <IgnoreIfNullAttribute>(false) != null;
/// <summary> /// Gets the state that determines this attribute is be ignored or not /// </summary> /// <param name="attribute"></param> /// <returns></returns> public static bool IsIgnored(this ObjectService.AttributeInfo attribute) => attribute?.GetCustomAttribute <IgnoreAttribute>(false) != null || attribute?.GetCustomAttribute <MongoDB.Bson.Serialization.Attributes.BsonIgnoreAttribute>(false) != null;