private static List<string> _needSaveAttributes = new List<string>(new string[]{"int","int16","int32","int64", "single", "double","datetime","bool","boolean","string" });
private static List<PropertyInfo> _attributes;
public static List<PropertyInfo> Attributes
{
get
{
if (_attributes == null)
{
_attributes = new List<PropertyInfo>();
foreach (PropertyInfo info in CurrentType.GetProperties())
{
if (_needSaveAttributes.Contains(info.PropertyType.Name.ToLower()))
{
_attributes.Add(info);
}
}
}
return _attributes;
}
}
private static Type _type;
private static Type CurrentType
{
get
{
if(_type==null)
{
_type=typeof(T);
}
return _type;
}
}
private static List<PropertyInfo> _attributes;
public static List<PropertyInfo> Attributes
{
get
{
if (_attributes == null)
{
_attributes = new List<PropertyInfo>();
foreach (PropertyInfo info in CurrentType.GetProperties())
{
if (_needSaveAttributes.Contains(info.PropertyType.Name.ToLower()))
{
_attributes.Add(info);
}
}
}
return _attributes;
}
}
private static Type _type;
private static Type CurrentType
{
get
{
if(_type==null)
{
_type=typeof(T);
}
return _type;
}
}

浙公网安备 33010602011771号