using iWareCommon.Common.Entity;
using iWareCommon.Utils;
using iWareDataCore.ORM;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace iWareDataCore.RBAC.Entity
{
///
/// 角色实体类
///
public class MacUserEntity : ICommonEntity
{
///
/// 主键
///
public int Id { get; set; }
///
/// 角色名称
///
public string MacAddress { get; set; }
///
/// 备注
///
public string Remark { get; set; }
///
/// 构造函数
///
public MacUserEntity() { }
///
/// 构造函数
///
/// 角色
public MacUserEntity(RBACMacUser role)
{
EntityPropHelper.CopyProp(role, this, GetColumnMap());
}
///
/// 将对象转换成ORM中的类型
///
/// Orm中的角色类型
public RBACMacUser ToOrm()
{
RBACMacUser role = new RBACMacUser();
EntityPropHelper.CopyProp(this, role, GetColumnMap());
return role;
}
///
/// 获取自定义角色类中的字段名为键,orm中对象的字段名为值的字段
///
///
public static Dictionary GetColumnMap()
{
return new Dictionary()
{
{"Id", "id"},
{"MacAddress", "macaddress"},
{"Remark","remark"}
};
}
///
/// 根据MacUserEntity的字段转RBAC_MacUser的字段
///
/// MacUserEntity的字段
/// RBAC_MacUser
public static string GetColumnName(string name)
{
var columnMap = GetColumnMap();
return columnMap.ContainsKey(name) ? columnMap[name] : name;
}
///
/// 获取MacUserEntity对于的表名
///
/// RBAC_MacUser
public static string GetTableName()
{
return "[dbo].[RBACMacUser]";
}
}
}