public OfficeRepository( IAmbientDbContextLocator contextLocator, IDbContextScopeFactory contextScopeFactory) { _contextLocator = contextLocator; _contextScopeFactory = contextScopeFactory; }
public DistinteDataService(ILog log, IAmbientDbContextLocator ambientDbContextLocator) : base(ambientDbContextLocator) { CheckConstructorParameters(log, ambientDbContextLocator); _log = log; _listDistinte = new List <DistintaBrowsed>(); var distintaBrowsed1 = DistintaBrowsed.Of("CodDistinta1", Somministrazioni.Common.Enums.StatoDistinta.Pianificata); var distintaBrowsed2 = DistintaBrowsed.Of("CodDistinta2", Somministrazioni.Common.Enums.StatoDistinta.Pianificata); var distintaBrowsed3 = DistintaBrowsed.Of("CodDistinta3", Somministrazioni.Common.Enums.StatoDistinta.Pianificata); var distintaBrowsed4 = DistintaBrowsed.Of("CodDistinta4", Somministrazioni.Common.Enums.StatoDistinta.Pianificata); var distintaBrowsed5 = DistintaBrowsed.Of("CodDistinta5", Somministrazioni.Common.Enums.StatoDistinta.Pianificata); var distintaBrowsed6 = DistintaBrowsed.Of("CodDistinta6", Somministrazioni.Common.Enums.StatoDistinta.Pianificata); var distintaBrowsed7 = DistintaBrowsed.Of("CodDistinta7", Somministrazioni.Common.Enums.StatoDistinta.Pianificata); var distintaBrowsed8 = DistintaBrowsed.Of("CodDistinta8", Somministrazioni.Common.Enums.StatoDistinta.Pianificata); var distintaBrowsed9 = DistintaBrowsed.Of("CodDistinta9", Somministrazioni.Common.Enums.StatoDistinta.Pianificata); var distintaBrowsed10 = DistintaBrowsed.Of("CodDistinta10", Somministrazioni.Common.Enums.StatoDistinta.Pianificata); var distintaBrowsed11 = DistintaBrowsed.Of("CodDistinta11", Somministrazioni.Common.Enums.StatoDistinta.Pianificata); _listDistinte.Add(distintaBrowsed1); _listDistinte.Add(distintaBrowsed2); _listDistinte.Add(distintaBrowsed3); _listDistinte.Add(distintaBrowsed4); _listDistinte.Add(distintaBrowsed5); _listDistinte.Add(distintaBrowsed6); _listDistinte.Add(distintaBrowsed7); _listDistinte.Add(distintaBrowsed8); _listDistinte.Add(distintaBrowsed9); _listDistinte.Add(distintaBrowsed10); _listDistinte.Add(distintaBrowsed11); }
public UnitOfWorkScopeFactory(IDbContextFactoryProducerSingleton dbContextFactory = null, IAmbientDbContextLocator contextLocator = null, IGenericRepositoryFactory repositoryFactory = null, IDomainEvents domainEvents = null) { _dbContextFactory = dbContextFactory; _contextLocator = contextLocator; _repositoryFactory = repositoryFactory; _domainEvents = domainEvents; }
public WynnDbContextScope( IDbContextScope dbContextScope, IAmbientDbContextLocator dbContextLocator) { _dbContextScope = dbContextScope; _dbContextLocator = dbContextLocator; }
public WynnContextScopeFactory( IAmbientDbContextLocator dbContextLocator, IDbContextScopeFactory dbContextScopeFactory) { _dbContextLocator = dbContextLocator; _dbContextScopeFactory = dbContextScopeFactory; }
public ContrattiDataService(ILog log, IAmbientDbContextLocator ambientDbContextLocator) : base(ambientDbContextLocator) { CheckConstructorParameters(log, ambientDbContextLocator); _listContratti = new List <ContrattoBrowsed>(); var contrattoBrowsed1 = ContrattoBrowsed.Of("CodContratto1"); var contrattoBrowsed2 = ContrattoBrowsed.Of("CodContratto2"); var contrattoBrowsed3 = ContrattoBrowsed.Of("CodContratto3"); var contrattoBrowsed4 = ContrattoBrowsed.Of("CodContratto4"); var contrattoBrowsed5 = ContrattoBrowsed.Of("CodContratto5"); var contrattoBrowsed6 = ContrattoBrowsed.Of("CodContratto6"); var contrattoBrowsed7 = ContrattoBrowsed.Of("CodContratto7"); var contrattoBrowsed8 = ContrattoBrowsed.Of("CodContratto8"); var contrattoBrowsed9 = ContrattoBrowsed.Of("CodContratto9"); var contrattoBrowsed10 = ContrattoBrowsed.Of("CodContratto10"); var contrattoBrowsed11 = ContrattoBrowsed.Of("CodContratto11"); _listContratti.Add(contrattoBrowsed1); _listContratti.Add(contrattoBrowsed2); _listContratti.Add(contrattoBrowsed3); _listContratti.Add(contrattoBrowsed4); _listContratti.Add(contrattoBrowsed5); _listContratti.Add(contrattoBrowsed6); _listContratti.Add(contrattoBrowsed7); _listContratti.Add(contrattoBrowsed8); _listContratti.Add(contrattoBrowsed9); _listContratti.Add(contrattoBrowsed10); _listContratti.Add(contrattoBrowsed11); }
public DrinkCostRepository( IAmbientDbContextLocator contextLocator, IDbContextScopeFactory contextScopeFactory) { _contextLocator = contextLocator; _contextScopeFactory = contextScopeFactory; }
/*private readonly IDbSet<UserLogin> userLogins; * private readonly IDbSet<UserClaim> userClaims; * private readonly IDbSet<UserRole> userRoles; * private readonly IDbSet<Role> roles;*/ public UserRepository(IAmbientDbContextLocator ambientDbContextLocator) : base(ambientDbContextLocator) { /*this.userLogins = this.DbContext.Set<UserLogin>(); * this.userClaims = this.DbContext.Set<UserClaim>(); * this.userRoles = this.DbContext.Set<UserRole>(); * this.roles = this.DbContext.Set<Role>();*/ }
public DraftOrderViewModelGenerator(IDbContextScopeFactory factory, ILogger <DraftOrderViewModelGenerator> logger, IAmbientDbContextLocator locator) : base(locator) { this.factory = factory; this.logger = logger; }
public PricedOrderViewModelGenerator(IDbContextScopeFactory contextFactory, IAmbientDbContextLocator locator, IMemoryCache cache) : base(locator) { this.contextFactory = contextFactory; //this.seatDescriptionsCache = MemoryCache.Default; seatDescriptionsCache = cache; }
static void CheckGetInstanceParameters(IAmbientDbContextLocator ambientContextLocator) { if (ambientContextLocator == null) { throw new ArgumentException(GenericConstants.ERRMSG_NULLOREMPTYARGUMENT + GenericConstants.CHR_SPACE + nameof(ambientContextLocator)); } }
public CoffeeMenuRepository( IAmbientDbContextLocator contextLocator, IDbContextScopeFactory contextScopeFactory) { _contextLocator = contextLocator; _contextScopeFactory = contextScopeFactory; }
public WorkshopViewModelGenerator(IDbContextScopeFactory contextFactory, ICommandBus bus, IAmbientDbContextLocator locator, ILogger <WorkshopViewModelGenerator> logger) : base(locator) { this.contextFactory = contextFactory; this.bus = bus; this.logger = logger; }
public UserAccountRepository(IAmbientDbContextLocator ambientDbContextLocator) { if (ambientDbContextLocator == null) { throw new ArgumentNullException("ambientDbContextLocator"); } _ambientDbContextLocator = ambientDbContextLocator; }
public BaseAmbientDbContextScope(IAmbientDbContextLocator ambientDbContextLocator) { if (ambientDbContextLocator == null) { throw new ArgumentNullException("ambientDbContextLocator"); } _ambientDbContextLocator = ambientDbContextLocator; }
public OrderRepository(IAmbientDbContextLocator ambientDbContextLocator) { if (ambientDbContextLocator == null) { throw new ArgumentNullException("ambientDbContextLocator"); } this.ambientDbContextLocator = ambientDbContextLocator; }
public EntityRepository(IAmbientDbContextLocator ambientDbContextLocator) { if (ambientDbContextLocator == null) { throw new ArgumentNullException(nameof(ambientDbContextLocator)); } _ambientDbContextLocator = ambientDbContextLocator; }
public SqlQuery(IDbContextScopeFactory factory, IAmbientDbContextLocator locator, ITextSerializer serializer, QueryCriteria criteria) : base(locator) { this.factory = factory; this.locator = locator; this.serializer = serializer; this.criteria = criteria; }
public SchoolQueryService(IAmbientDbContextLocator dbContextLocator, IRepositoryLocator repositoryLocator) { Guard.AgainstNull(dbContextLocator, nameof(dbContextLocator)); Guard.AgainstNull(repositoryLocator, nameof(repositoryLocator)); this.dbContextLocator = dbContextLocator; this.repositoryLocator = repositoryLocator; }
public AmbientContext(IAmbientDbContextLocator locator) { if (locator == null) { throw new ArgumentNullException("ambientDbContextLocator"); } _ambientLocator = locator; }
public Repository(IAmbientDbContextLocator dbContextLocator) { if (dbContextLocator == null) { throw new ArgumentNullException("dbContextLocator"); } this._dbContextLocator = dbContextLocator; }
/// <summary> /// Initializes a new instance of the BaseRepository class. /// </summary> /// <param name="dbContextScopeLocator"> /// The context manager. /// </param> public BaseRepository(IAmbientDbContextLocator dbContextScopeLocator) { if (dbContextScopeLocator == null) { throw new ArgumentNullException(nameof(dbContextScopeLocator)); } this.DbContextScopeLocator = dbContextScopeLocator; }
protected BaseRepository(IAmbientDbContextLocator ambientDbContextLocator) { if (ambientDbContextLocator == null) { throw new ArgumentNullException("ambientDbContextLocator"); } _ambientDbContextLocator = ambientDbContextLocator; Logger = LoggerFactory.GetLogger(GetType()); }
/// <summary> /// Constructor that receives a DbContextLocator instance. /// </summary> /// <param name="dbContextLocator">DbContextLocator instance.</param> public EntityFrameworkRepository(IAmbientDbContextLocator dbContextLocator) { if (dbContextLocator == null) { throw new ArgumentNullException(nameof(dbContextLocator)); } this.dbContextLocator = dbContextLocator; }
protected RepositoryBase(IAmbientDbContextLocator ctxLocator) { if (ctxLocator == null) { throw new ArgumentNullException(nameof(ctxLocator)); } _contextLocator = ctxLocator; _dbset = _contextLocator.Get <TDbContext> .Set <T>(); }
public RepositoryFactory( IAmbientDbContextLocator ambientDbContextLocator) { _ambientDbContextLocator = ambientDbContextLocator ?? throw new ArgumentNullException(nameof(ambientDbContextLocator)); _InstatiatedTypes = new Dictionary <Type, object>(); _registeredTypes = new Dictionary <Type, Type>(); RegisterRepositoryTypes(); }
public SqlMessageLog(IDbContextScopeFactory factory, IAmbientDbContextLocator locator, ITextSerializer serializer, IMetadataProvider metadataProvider) : base(locator) { this.serializer = serializer; this.metadataProvider = metadataProvider; this.factory = factory; this.locator = locator; }
public Repository(IAmbientDbContextLocator dbContextLocator) { if (dbContextLocator == null) { throw new ArgumentNullException(nameof(dbContextLocator) + " is null"); } _dbContextLocator = dbContextLocator; }
public void TestSetup() { this.ambientDbContextLocator = new AmbientDbContextLocator(); this.dbContextScopeFactory = new DbContextScopeFactory(); this.repository = new Repository<ApplicationDbContext, ToDoItem, int>(this.ambientDbContextLocator); Database.SetInitializer(new ApplicationDbInitializer()); }
public static T GetOrThrow <T>(this IAmbientDbContextLocator locator) where T : DbContext { var result = locator.Get <T>(); if (result == null) { throw new InvalidOperationException($"Ambient {typeof(T).Name} is expected at this point"); } return(result); }
public AnchorAssignmentsViewModelGenerator( IWorkshopDao workshopDao, IBlobStorage storage, ITextSerializer serializer, IDbContextScopeFactory factory, IAmbientDbContextLocator locator) : base(locator) { this.workshopDao = workshopDao; this.storage = storage; this.serializer = serializer; this.factory = factory; }
public PhotographRepository(IAmbientDbContextLocator ambientDbContextLocator) { if (ambientDbContextLocator == null) throw new ArgumentNullException("ambientDbContextLocator"); _ambientDbContextLocator = ambientDbContextLocator; }
//private UserManagementDbContext DbContext //{ // get // { // var dbContext = ambientDbContextLocator.Get<UserManagementDbContext>(); // if (dbContext == null) // throw new InvalidOperationException("No ambient DbContext of type UserManagementDbContext found. This means that this repository method has been called outside of the scope of a DbContextScope. A repository must only be accessed within the scope of a DbContextScope, which takes care of creating the DbContext instances that the repositories need and making them available as ambient contexts. This is what ensures that, for any given DbContext-derived type, the same instance is used throughout the duration of a business transaction. To fix this issue, use IDbContextScopeFactory in your top-level business logic service method to create a DbContextScope that wraps the entire business transaction that your service method implements. Then access this repository within that scope. Refer to the comments in the IDbContextScope.cs file for more details."); // return dbContext; // } //} public UserRepository(IAmbientDbContextLocator ambientDbContextLocator) { if (ambientDbContextLocator == null) throw new ArgumentNullException("ambientDbContextLocator"); this.ambientDbContextLocator = ambientDbContextLocator; }
public void Setup() { _dbContextScopeFactory = Substitute.For<IDbContextScopeFactory>(); _ambientDbContextLocator = Substitute.For<IAmbientDbContextLocator>(); _photographRepository = Substitute.For<IPhotographRepository>(); _dbContext = Substitute.For<IDbContextScope>(); _dbContextScopeFactory.Create().Returns(_dbContext); _photographService = new PhotographServices(_dbContextScopeFactory, _photographRepository); }
public TodoItemsService2(IDbContextScope dbContextScope, IAmbientDbContextLocator ambientDbContextLocator, IUserAlertService userAlertService) { _dbContextScope = dbContextScope; _ambientDbContextLocator = ambientDbContextLocator; _userAlertService = userAlertService; }
//readonly EtfDbContext db = EtfDbContext.Create(); public UserProfileRepository(IAmbientDbContextLocator ambientDbContextLocator) { if (ambientDbContextLocator == null) throw new ArgumentNullException(nameof(ambientDbContextLocator)); this._ambientDbContextLocator = ambientDbContextLocator; }
public TodoItemsService1(IAmbientDbContextLocator ambientDbContextLocator, IData data) { _ambientDbContextLocator = ambientDbContextLocator; _data = data; }