C# Class FrameDAL.Utility.ReflectionExtensions

ファイルを表示 Open project: vincentlauvlwj/FrameDAL

Public Methods

Method Description
GetCachedProperties ( this type ) : System.Reflection.PropertyInfo[]

从缓存中获得类的所有属性

GetColumnAttribute ( this prop ) : ColumnAttribute

从缓存中获取属性的Column特性类对象

GetIdAttribute ( this prop ) : IdAttribute

从缓存中获取属性的Id特性类对象

GetIdProperty ( this type ) : PropertyInfo

从缓存中获取类的ID属性,ID属性是指添加了Id特性的属性

GetManyToManyAttribute ( this prop ) : ManyToManyAttribute
GetManyToOneAttribute ( this prop ) : ManyToOneAttribute
GetOneToManyAttribute ( this prop ) : OneToManyAttribute
GetTableAttribute ( this type ) : TableAttribute

获取缓存中的Table特性类对象

GetValue ( this member, object instance ) : object
SetValue ( this member, object instance, object value ) : void
SetValueSafely ( this prop, object entity, object value ) : void

安全设置实体属性的值

Method Details

GetCachedProperties() public static method

从缓存中获得类的所有属性
type为null 该类中没有任何公开属性
public static GetCachedProperties ( this type ) : System.Reflection.PropertyInfo[]
type this 要获取属性的类
return System.Reflection.PropertyInfo[]

GetColumnAttribute() public static method

从缓存中获取属性的Column特性类对象
type为null 该属性的Column特性没有正确配置
public static GetColumnAttribute ( this prop ) : ColumnAttribute
prop this 要获取特性的属性
return FrameDAL.Attributes.ColumnAttribute

GetIdAttribute() public static method

从缓存中获取属性的Id特性类对象
type为null 该属性的Id特性没有正确配置
public static GetIdAttribute ( this prop ) : IdAttribute
prop this 要获取特性的属性
return FrameDAL.Attributes.IdAttribute

GetIdProperty() public static method

从缓存中获取类的ID属性,ID属性是指添加了Id特性的属性
该类没有配置ID属性 type为null 该类的Id特性没有正确配置
public static GetIdProperty ( this type ) : PropertyInfo
type this 要获取ID属性的类
return System.Reflection.PropertyInfo

GetManyToManyAttribute() public static method

public static GetManyToManyAttribute ( this prop ) : ManyToManyAttribute
prop this
return FrameDAL.Attributes.ManyToManyAttribute

GetManyToOneAttribute() public static method

public static GetManyToOneAttribute ( this prop ) : ManyToOneAttribute
prop this
return FrameDAL.Attributes.ManyToOneAttribute

GetOneToManyAttribute() public static method

public static GetOneToManyAttribute ( this prop ) : OneToManyAttribute
prop this
return FrameDAL.Attributes.OneToManyAttribute

GetTableAttribute() public static method

获取缓存中的Table特性类对象
该类没有添加Table特性,或者Table.Name属性为空或空白字符串 type为null
public static GetTableAttribute ( this type ) : TableAttribute
type this 要获取特性的类
return FrameDAL.Attributes.TableAttribute

GetValue() public static method

public static GetValue ( this member, object instance ) : object
member this
instance object
return object

SetValue() public static method

public static SetValue ( this member, object instance, object value ) : void
member this
instance object
value object
return void

SetValueSafely() public static method

安全设置实体属性的值
public static SetValueSafely ( this prop, object entity, object value ) : void
prop this 属性
entity object 要设置属性值的实体
value object
return void