using iWareCommon.Common.Entity; using iWareCommon.Utils; using iWareLog.ORM; using System; using System.Collections.Generic; namespace iWareLog.LOG.Entity { public class SendMsgLogEntity : ICommonEntity { /// /// 接受信息日志主键 /// public int Id { get; set; } /// /// 调用接口名称 /// public string InterfaceName { get; set; } /// /// 请求字符串 /// public string RequestStr { get; set; } /// /// 应答字符串 /// public string ResponseStr { get; set; } /// /// 发送时间 /// public DateTime SendTime { get; set; } /// /// 备注 /// public string Remark { get; set; } /// /// 构造函数 /// public SendMsgLogEntity() { } /// /// 接受类型,0为wip,1为rcs, 2为人工发送 /// public int Type { get; set; } /// /// 构造函数 /// /// orm中的模型 public SendMsgLogEntity(LOGSendMsgLog send) { EntityPropHelper.CopyProp(send, this, GetColumnMap()); } /// /// 获取自定义类SendMsgLogEntity的字段名为键,ORM对象中字段名为值的字段 /// /// public static Dictionary GetColumnMap() { return new Dictionary() { {"Id", "id"}, {"Type", "type"}, {"InterfaceName", "interfacename"}, {"RequestStr", "requeststr"}, {"ResponseStr", "responsestr"}, {"SendTime","sendtime"}, {"Remark","remark"} }; } /// /// 将SendMsgLogEntity实体转化为orm里面的LOGSendMsgLog模型 /// /// orm中的LOGReceiveMsgLog模型 public LOGSendMsgLog ToOrm() { var send = new LOGSendMsgLog(); EntityPropHelper.CopyProp(this, send, GetColumnMap()); return send; } /// /// 根据SendMsgLogEntity的字段转LOGSendMsgLog的字段 /// /// SendMsgLogEntity的字段 /// LOGSendMsgLog public static string GetColumnName(string name) { var columnMap = GetColumnMap(); return columnMap.ContainsKey(name) ? columnMap[name] : name; } /// /// 获取SendMsgLogEntity对应的表名 /// /// LOGSendMsgLog public static string GetTableName() { return "[dbo].[LOGSendMsgLog]"; } } }