Beispiel #1
0
        public async Task <T> Create(T entity)
        {
            await _dbContext.Set <T>().AddAsync(entity);

            await _dbContext.SaveChangesAsync();

            return(entity);
        }
        public static void DetachLocal <T>(this Cube3DIntersectionDbContext context, T t, int entryId) where T : class, IEntity
        {
            var local = context.Set <T>()
                        .Local
                        .FirstOrDefault(entry => entry.Id.Equals(entryId));

            if (local != null)
            {
                context.Entry(local).State = EntityState.Detached;
            }
            context.Entry(t).State = EntityState.Modified;
        }