Ejemplo n.º 1
0
 public UnitOfWork(bool forceNewContext)
 {
     if (forceNewContext)
     {
         DataContextFactory.Clear();
     }
 }
Ejemplo n.º 2
0
        public void ExecuteSqlCommand(string cmd)
        {
            this.dbContext.Database.ExecuteSqlCommand(cmd);
            DataContextFactory.Clear();
            var context = DataContextFactory.GetDataContext();

            this.dbContext = context ?? throw new ArgumentNullException(nameof(context));
            this.dbSet     = this.dbContext.Set <TEntity>();
        }
Ejemplo n.º 3
0
        public void Commit(bool resetAfterCommit)
        {
            DataContextFactory.GetDataContext().SaveChanges();

            if (resetAfterCommit)
            {
                DataContextFactory.Clear();
            }
        }
 protected Task ExecuteSqlCommand(string cmd)
 {
     return(Task.Run(
                () =>
     {
         this.dbContext.Database.ExecuteSqlCommand(cmd);
         DataContextFactory.Clear();
         var context = DataContextFactory.GetDataContext();
         this.dbContext = context ?? throw new ArgumentNullException(nameof(context));
         this.dbSet = this.dbContext.Set <TEntity>();
     }));
 }
Ejemplo n.º 5
0
 public void Undo()
 {
     DataContextFactory.Clear();
 }