public UsersController( IDbContextAccessor dbContextAccessor, IUnitOfWork unitOfWork, UserContext userContext) { this.dbContextAccessor = dbContextAccessor; this.unitOfWork = unitOfWork; this.userContext = userContext; }
public TasksController( UserContext userContext, IUnitOfWork unitOfWork, ITasksRepository tasksRepository, IDbContextAccessor dbContextAccessor) { this.userContext = userContext; this.unitOfWork = unitOfWork; this.tasksRepository = tasksRepository; this.dbContextAccessor = dbContextAccessor; }
// private readonly TransactionScope _transaction; public HandlingScope(IDiContainerAccessor containerAccessor, HandlerIdentity identity) { Identity = identity; _containerAccessor = containerAccessor; _contextAccessor = _containerAccessor.GetInstance <IDbContextAccessor>(); _handlingScopesStack = _containerAccessor.GetInstance <IHandlingScopesStack <HandlingScope> >(); _parentScope = _handlingScopesStack.GetCurrentScope(); _handlingScopesStack.EnterScope(this); // _transaction = new TransactionScope(TransactionScopeOption.Required, // new TransactionOptions {IsolationLevel = IsolationLevel.Snapshot}); }
private static void SetCurrentUow(IDbContextAccessor value) { lock (AsyncLocalUow) { if (value == null) { if (AsyncLocalUow.Value == null) { return; } if (AsyncLocalUow.Value.UnitOfWork?.Outer == null) { AsyncLocalUow.Value.UnitOfWork = null; AsyncLocalUow.Value = null; return; } AsyncLocalUow.Value.UnitOfWork = AsyncLocalUow.Value.UnitOfWork; } else { if (AsyncLocalUow.Value?.UnitOfWork == null) { if (AsyncLocalUow.Value != null) { AsyncLocalUow.Value.UnitOfWork = value; } AsyncLocalUow.Value = new LocalUowWrapper(value); return; } value.Outer = AsyncLocalUow.Value.UnitOfWork.Outer; AsyncLocalUow.Value.UnitOfWork = value; } } }
public AggregateRepository(IDbContextAccessor dbContextAccessor) { this.dbContextAccessor = dbContextAccessor; }
public LocalUowWrapper(IDbContextAccessor unitOfWork) { UnitOfWork = unitOfWork; }
public GenericEntityRepository(IDbContextAccessor contextAccessor) { _contextAccessor = contextAccessor; _setAccessor = contextAccessor.Set <T>(); }
public TaskNomsController(IDbContextAccessor accessor, UserContext userContext) { this.accessor = accessor; this.userContext = userContext; }
public EntityReader(IDbContextAccessor contextAccessor) { _setAccessor = contextAccessor.Set <TEntity>(); _queryable = _setAccessor.NotTracked(); }
public EfUnitOfWork(IDbContextAccessor dbContextAccessor) { _dbContext = dbContextAccessor.Context; }
public OrderRepo(IDbContextAccessor <ReferenceDbContext> dbContextAccessor) { this.DbContextAccessor = dbContextAccessor ?? throw new ArgumentNullException(nameof(dbContextAccessor)); }
public EfRepository(IDbContextAccessor contextAccessor) { Context = contextAccessor.Context; DbSet = Context.Set <TEntity>(); }
public TasksRepository(IDbContextAccessor dbContextAccessor) : base(dbContextAccessor) { }
/// <summary> /// This repository in the infrastructure/persistence layer has an <see cref="IDbContextAccessor{TDbContext}"/> injected. /// This gives it access to the <see cref="Microsoft.EntityFrameworkCore.DbContext"/> provided and managed by a service higher up the call stack, usually in the orchestrating layer. /// </summary> public OrderRepository(IDbContextAccessor <ExampleDbContext> dbContextAccessor) { this.DbContextAccessor = dbContextAccessor ?? throw new ArgumentNullException(nameof(dbContextAccessor)); }