//private void DispatchEvents(T entity) //{ // var events = entity.GetUnPublishedEvents().ToList(); // entity.ClearEvents(); // events.ForEach(@event => // { // @event.AggregateRootId = entity.Id.ToString(); // @event.CreateDate = DateTime.Now; // @event.UserName = Thread.CurrentPrincipal.Identity.Name; // dispatchMethod.MakeGenericMethod(@event.GetType()).Invoke(eventDispatcher, new object[] { @event }); // }); // foreach (var e in events) // { // //session.Save(new Event(e.GetType().FullName, e.UserName, e.AggregateRootId, // // JsonConvert.SerializeObject(e, setting), e.GetType().FullName)); // } //} public async Task AddRangeAsync(IEnumerable <T> items) { await _dbContext.AddRangeAsync(items); }