接着上一次没有做完的DemoData控制台应用程序,开始
编写实体类
新建Entities文件夹,新建类如下图

实体类代码如下
Role(角色)类
User(用户)类
编写Mapper类
新建Mappers文件夹,创建如下Mapper类
Role的Mapper类
using CoolEntity.Mapping;
using CoolEntity.Mapping.Commom;
using DemoData.Entities;
namespace DemoData.Mappers
{
/// <summary>
/// 角色的Mapper类
/// </summary>
internal class RoleMapper : EntityMapper<Role>
{
/// <summary>
/// 获取所Mapping的Table
/// </summary>
/// <returns>所Mapping的Table信息</returns>
protected override ITableInfo GetTableInfo()
{
return base.GetTableInfo("Roles", "dbo");
}