public virtual T Create <T>(T model) where T : DbObject, new() { IDbObjectInfo <T> dbObjectInfo = this.DbRuleContext.GetDbObjectInfo <T>(); model = dbObjectInfo.CreateClone(this, model); dbObjectInfo.CheckDuplicate(this, model, new string[0]); dbObjectInfo.SetModifyDatetime(model); this.Validate <T>(model, DbOperation.Create); this.DbObjectOperator.Insert(model); return(model); }
public virtual T Update <T>(T model) where T : DbObject, new() { IDbObjectInfo <T> dbObjectInfo = this.DbRuleContext.GetDbObjectInfo <T>(); dbObjectInfo.CheckDuplicate(this, model, new string[0]); T local = dbObjectInfo.UpdateClone(this, model, new string[0]); this.Validate <T>(local, DbOperation.None | DbOperation.Update); dbObjectInfo.SetModifyDatetime(local); this.DbObjectOperator.Update(local); return(local); }