public EFUnitOfWork(ICqrsDependencyResolver dependecyResolver) : base(dependecyResolver) { // Disable transaction this._transactionScope = null; // Create data context this._context = new TDbContext(); this._dataSource = new Lazy <IDataSource>(() => new EFDataSource(this._context)); this._repository = new Lazy <IRepository>(() => (IRepository) new EFRepository(this._context)); }
protected UnitOfWorkBase(ICqrsDependencyResolver dependecyResolver) { Contract.Requires(dependecyResolver != null); this._dependencyResolver = dependecyResolver; this._transactionCommands = new Queue <ICommandHandlerTransactionSupport>(); this._paramsCache = new Lazy <CqrsParameterOverride[]>(() => new[] { new CqrsParameterOverride("repository", typeof(IRepository), this.Repository), new CqrsParameterOverride("dataSource", typeof(IDataSource), this.DataSource) }); }
private EFUnitOfWork(ICqrsDependencyResolver dependecyResolver, TransactionOptions transactionOptions, bool useCurrentTransaction) : base(dependecyResolver) { // Enable transaction this._transactionOptions = transactionOptions; this._transactionScope = new TransactionScope( useCurrentTransaction ? TransactionScopeOption.Required : TransactionScopeOption.RequiresNew, this._transactionOptions); // Create data context this._context = new TDbContext(); this._dataSource = new Lazy <IDataSource>(() => new EFDataSource(this._context)); this._repository = new Lazy <IRepository>(() => (IRepository) new EFRepository(this._context)); }
private EFUnitOfWork(ICqrsDependencyResolver dependecyResolver, bool enableTransactions, bool useCurrentTransaction) : base(dependecyResolver) { // Enable transaction if required if (enableTransactions) { this._transactionOptions = new TransactionOptions { IsolationLevel = IsolationLevel.ReadUncommitted }; this._transactionScope = new TransactionScope( useCurrentTransaction ? TransactionScopeOption.Required : TransactionScopeOption.RequiresNew, this._transactionOptions); } else { this._transactionScope = null; } // Create data context this._context = new TDbContext(); this._dataSource = new Lazy <IDataSource>(() => new EFDataSource(this._context)); this._repository = new Lazy <IRepository>(() => (IRepository) new EFRepository(this._context)); }
/// <summary>Initializes a new instance of the <see cref="EFUnitOfWorkFactory{TDbContext}"/> class.</summary> /// <param name="dependencyResolver">The CQRS dependency resolver.</param> public EFUnitOfWorkFactory(ICqrsDependencyResolver dependencyResolver) { Contract.Requires(dependencyResolver != null); this._dependencyResolver = dependencyResolver; }
public EFUnitOfWork(ICqrsDependencyResolver dependecyResolver, TransactionOptions transactionOptions) : this(dependecyResolver, transactionOptions, useCurrentTransaction : false) { }
public EFUnitOfWork(ICqrsDependencyResolver dependecyResolver, bool enableTransactions) : this(dependecyResolver, enableTransactions, useCurrentTransaction : false) { }