mirror of https://github.com/abpframework/abp.git
csharpabpc-sharpframeworkblazoraspnet-coredotnet-coreaspnetcorearchitecturesaasdomain-driven-designangularmulti-tenancy
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
1.1 KiB
39 lines
1.1 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel.DataAnnotations;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Volo.Abp.ObjectExtending;
|
|
|
|
public static class ObjectExtensionPropertyInfoBlazorExtensions
|
|
{
|
|
private static readonly Type[] DateTimeTypes =
|
|
{
|
|
typeof(DateTime),
|
|
typeof(DateTime?),
|
|
typeof(DateTimeOffset),
|
|
typeof(DateTimeOffset?)
|
|
};
|
|
|
|
public static bool IsDate(this IBasicObjectExtensionPropertyInfo property)
|
|
{
|
|
return DateTimeTypes.Contains(property.Type) &&
|
|
property.GetDataTypeOrNull() == DataType.Date;
|
|
}
|
|
|
|
public static bool IsDateTime(this IBasicObjectExtensionPropertyInfo property)
|
|
{
|
|
return DateTimeTypes.Contains(property.Type) &&
|
|
!property.IsDate();
|
|
}
|
|
|
|
public static DataType? GetDataTypeOrNull(this IBasicObjectExtensionPropertyInfo property)
|
|
{
|
|
return property
|
|
.Attributes
|
|
.OfType<DataTypeAttribute>()
|
|
.FirstOrDefault()?.DataType;
|
|
}
|
|
}
|
|
|