public BaseRepositoryProvider(Dictionary <Type, object> repositoryCache, IBaseRepositoryFactory <TDbContext> repositoryFactory, TDbContext dataContext) { RepositoryCache = repositoryCache; RepositoryFactory = repositoryFactory; DataContext = dataContext; }
public ModelFactory(string path = null) { webAPI = false; if (!_loaded) { lock ("Ninject") { if (!_loaded) { _loaded = true; string p = path?.Substring(path.IndexOf("^") + 1) ?? AppDomain.CurrentDomain.BaseDirectory; using (var kernel = new StandardKernel()) { kernel.Bind(x => x.FromAssembliesInPath(p, y => y.FullName.StartsWith("VendingMachine")).SelectAllClasses().InheritedFrom <IBaseRepositoryFactory>().BindAllInterfaces().Configure(y => y.When(z => z.Target?.Type != typeof(IRepositoryFactory)).BindingConfiguration.Parameters.Add(new ConstructorArgument("path", p)))); _storageRepo = kernel.GetAll <IRepositoryFactory>().FirstOrDefault(); _initRepo = kernel.GetAll <IBaseRepositoryFactory>().FirstOrDefault(x => (x as IRepositoryFactory) == null); } } } } }
public BaseRepositoryProvider(IBaseRepositoryFactory <TDbContext> repositoryFactory, TDbContext dataContext) : this(new Dictionary <Type, object>(), repositoryFactory, dataContext) { }
public ConfigSource(IBaseRepositoryFactory configRepo) { _configRepo = configRepo; }
public StrategyHolder(IRepositoryFactory storageRepo, IBaseRepositoryFactory initRepo, bool webAPI) { _source = (storageRepo?.AuthUsersProxy.IsAuthComplete() ?? false) && (webAPI || (!storageRepo?.AuthUsersProxy.IsAdmin() ?? false)) ? new DatabaseSource(storageRepo) : new ConfigSource(initRepo.Clone() as IBaseRepositoryFactory) as ISourceSelector; }
public BaseRepositoryProvider(IBaseRepositoryFactory repositoryFactory, IDataContext dataContext) { _repositoryFactory = repositoryFactory; _dataContext = dataContext; }