/// <summary> /// Inserts the specified entity. /// </summary> /// <param name="entities">The entities.</param> public virtual void Insert(params TEntity[] entities) { foreach (var entity in entities) { Dbset.Add(entity); } }
public void InsertBulk(IEnumerable <Track> Entities) { foreach (Track track in Entities) { if (db.Entry(track).State == EntityState.Detached) { Dbset.Add(track); } } db.SaveChanges(); Dbset.AddRange(Entities); }
public override void Create(Task task) { if (Dbset.Any(x => x.Id != task.Id && x.UserId == task.UserId && x.Title.Equals(task.Title, StringComparison.OrdinalIgnoreCase) && x.ShortTitle.Equals(task.ShortTitle, StringComparison.OrdinalIgnoreCase) && x.Theme == task.Theme)) { throw new MyException("You already have a Task with the same Title, Short Title and Theme."); } task.Order = Convert.ToInt16(Dbset.Count(x => x.UserId == task.UserId && x.IsArchived == false) + 1); Dbset.Add(task); _context.SaveChanges(); }
public virtual void Add(T entity) { Dbset.Add(entity); }
public void Insert(Product product) { Dbset.Add(product); }
public void Inserir(TEntity t) { Dbset.Add(t); Context.SaveChanges(); }
/// <summary> /// 插入单条数据 /// </summary> /// <param name="entity">TEntity实体</param> public virtual void Insert(TEntity entity) { Dbset.Add(entity); }
/// <summary> /// 添加数据 /// </summary> /// <param name="tentity"></param> public void Add(Tentity tentity) { Dbset.Add(tentity); }