예제 #1
0
        public static bool TryAttachDefault(this IFullAuditableDbContext dbContext, object entity, out EntityEntry entry)
        {
            entry = dbContext.Entry(entity);

            if (entry.State == EntityState.Detached)
            {
                entry = dbContext.Attach(entity);

                return(true);
            }

            return(false);
        }
예제 #2
0
        public static bool TryAttachDefault <T>(this IFullAuditableDbContext dbContext, T entity, out EntityEntry <T> entry)
            where T : class
        {
            entry = dbContext.Entry(entity);

            if (entry.State == EntityState.Detached)
            {
                entry = dbContext.Attach(entity);

                return(true);
            }

            return(false);
        }