Ejemplo n.º 1
0
 public BaseRepositoryProvider(Dictionary <Type, object> repositoryCache,
                               IBaseRepositoryFactory <TDbContext> repositoryFactory, TDbContext dataContext)
 {
     RepositoryCache   = repositoryCache;
     RepositoryFactory = repositoryFactory;
     DataContext       = dataContext;
 }
Ejemplo n.º 2
0
 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);
                 }
             }
         }
     }
 }
Ejemplo n.º 3
0
 public BaseRepositoryProvider(IBaseRepositoryFactory <TDbContext> repositoryFactory, TDbContext dataContext) :
     this(new Dictionary <Type, object>(), repositoryFactory, dataContext)
 {
 }
Ejemplo n.º 4
0
 public ConfigSource(IBaseRepositoryFactory configRepo)
 {
     _configRepo = configRepo;
 }
Ejemplo n.º 5
0
 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;
 }
Ejemplo n.º 6
0
 public BaseRepositoryProvider(IBaseRepositoryFactory repositoryFactory, IDataContext dataContext)
 {
     _repositoryFactory = repositoryFactory;
     _dataContext       = dataContext;
 }