public void Add(T model) { if (string.IsNullOrEmpty(model.Id)) { model.Id = ObjectId.NewObjectId().ToString(); } _cache?.Add(model.Id, model); _lite.Insert(model); }
public virtual void Add(T model) { try { _cache?.Add("addMethod: " + model.Id.ToString(), model); _dbSet.Add(model); _db.SaveChanges(); _log.AddDocument(model); } catch (Exception ext) { _log.CatchError(ext.Message, 0, model, ext, "Add", null); } }