예제 #1
0
        public EfRepository(IEfContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            _context = context;
        }
        /// <summary>
        /// Clear cache
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public static int ClearCache(this IEfContext context)
        {
            if (context is DbContextBase ctx)
            {
                var changed = ctx.ChangeTracker.Entries().ForEachItem(entry => entry.State = EntityState.Detached);
                return(changed.Count());
            }

            return(0);
        }
예제 #3
0
 public StandardRepository(IEfContext context)
 {
     this.context = context;
     dbset        = context.Set <TEntity>();
 }
예제 #4
0
 public DatasetRepository(IEfContext context)
 {
     _context = context;
 }
예제 #5
0
 public Service(IEfContext efContext, ILogger logger)
 {
     this.efContext = efContext;
     FLogger        = logger;
 }
예제 #6
0
 public DefaultRepository(IEfContext context)
 {
     this.context = context;
     dbset        = context.Set <TEntity>();
 }