/// <summary> /// 创建一个对象 /// </summary> /// <param name="db">数据库</param> /// <param name="entity">实体</param> public int Create(SysLog entity) { using (DBContainer db = new DBContainer()) { db.SysLogs.AddObject(entity); return db.SaveChanges(); } }
public void WriteServiceLog(string oper, string mes, string result, string type, string module) { SysLog entity = new SysLog(); entity.Id = ResultHelper.NewId; entity.Operator = oper; entity.Message = mes; entity.Result = result; entity.Type = type; entity.Module = module; entity.CreateTime = ResultHelper.NowTime; this.Create(entity); }
/// <summary> /// 创建新的 SysLog 对象。 /// </summary> /// <param name="id">Id 属性的初始值。</param> public static SysLog CreateSysLog(global::System.String id) { SysLog sysLog = new SysLog(); sysLog.Id = id; return sysLog; }
/// <summary> /// 用于向 SysLogs EntitySet 添加新对象的方法,已弃用。请考虑改用关联的 ObjectSet<T> 属性的 .Add 方法。 /// </summary> public void AddToSysLogs(SysLog sysLog) { base.AddObject("SysLogs", sysLog); }
public int Create(SysLog entity) { return LogRepository.Create(entity); }