Class ClassMapper<T>
默认泛型实体映射器类
Inheritance
System.Object
ClassMapper<T>
Namespace: DapperDal.Mapper
Assembly: DapperDal.dll
Syntax
public class ClassMapper<T> : object, IClassMapper<T>, IClassMapper where T : class
Type Parameters
Name | Description |
---|---|
T |
Constructors
| Improve this Doc View SourceClassMapper()
初始化默认泛型实体映射器
Declaration
public ClassMapper()
Properties
| Improve this Doc View SourceEntityType
实体类型
Declaration
public Type EntityType { get; }
Property Value
Type | Description |
---|---|
Type |
Implements
| Improve this Doc View SourceProperties
实体属性信息列表
Declaration
public IList<IPropertyMap> Properties { get; }
Property Value
Type | Description |
---|---|
IList<IPropertyMap> |
Implements
| Improve this Doc View SourcePropertyTypeKeyTypeMapping
属性类型与键类型的对应关系字典
Declaration
protected Dictionary<Type, KeyType> PropertyTypeKeyTypeMapping { get; }
Property Value
Type | Description |
---|---|
Dictionary<Type, KeyType> |
SchemaName
数据库架构名
Declaration
public string SchemaName { get; protected set; }
Property Value
Type | Description |
---|---|
System.String |
Implements
| Improve this Doc View SourceTableName
数据库表名
Declaration
public string TableName { get; protected set; }
Property Value
Type | Description |
---|---|
System.String |
Implements
Methods
| Improve this Doc View SourceAutoMap()
执行自动映射
Declaration
protected virtual void AutoMap()
AutoMap(Func<Type, PropertyInfo, Boolean>)
执行自动映射
Declaration
protected virtual void AutoMap(Func<Type, PropertyInfo, bool> canMap)
Parameters
Type | Name | Description |
---|---|---|
Func<Type, PropertyInfo, System.Boolean> | canMap | 指示实体属性是否要映射的方法提供 |
Map(Expression<Func<T, Object>>)
设置实体属性映射,支持链式调用
Declaration
protected PropertyMap Map(Expression<Func<T, object>> expression)
Parameters
Type | Name | Description |
---|---|---|
Expression<Func<T, System.Object>> | expression | 实体属性映射表达式 |
Returns
Type | Description |
---|---|
PropertyMap | 实体属性映射器 |
Map(PropertyInfo)
设置实体属性映射,支持链式调用
Declaration
protected PropertyMap Map(PropertyInfo propertyInfo)
Parameters
Type | Name | Description |
---|---|---|
PropertyInfo | propertyInfo | 实体属性元数据访问器 |
Returns
Type | Description |
---|---|
PropertyMap | 实体属性映射器 |
Schema(String)
设置数据库架构名
Declaration
public virtual void Schema(string schemaName)
Parameters
Type | Name | Description |
---|---|---|
System.String | schemaName | 数据库架构名 |
Table(String)
设置数据库表名
Declaration
public virtual void Table(string tableName)
Parameters
Type | Name | Description |
---|---|---|
System.String | tableName | 设置数据库表名 |