Ejemplo n.º 1
0
 public CarService(ICarsRepository repository,
                   ICarOwnersRepository carOwnersRepository,
                   IIdentityService identityService)
 {
     _repository       = repository;
     _ownersRepository = carOwnersRepository;
     _identityService  = identityService;
 }
Ejemplo n.º 2
0
        public CarOwnersController(IConfiguration config)
        {
            _iConfig = config;
            CarOwnersFactory factory = new CarOwnersFactory();

            MemoryType memoryType = MemoryType.InMemory;

            try { memoryType = (MemoryType)Enum.Parse(typeof(MemoryType), _iConfig.GetValue <string>("data:memory")); }
            catch { memoryType = MemoryType.InMemory; }
            carOwners = factory.CreateRepository(memory: memoryType, connectionString: _iConfig.GetValue <string>("data:connectionString:mongoDb"));
        }
Ejemplo n.º 3
0
        public virtual ICarOwnersRepository CreateRepository(MemoryType memory = MemoryType.InMemory, string connectionString = "")
        {
            ICarOwnersRepository carOwners = null;

            switch (memory)
            {
            case MemoryType.MongoDB:
                try{ carOwners = new CarOwnersRepository(connectionString); }
                catch { carOwners = new CarOwnersInMemRepository(); }
                break;

            default:
                carOwners = new CarOwnersInMemRepository();
                break;
            }
            return(carOwners);
        }
Ejemplo n.º 4
0
 public CarOwnersService(ICarOwnersRepository _repository)
 {
     this.Rep = _repository;
 }
Ejemplo n.º 5
0
 public CarOwnerService(ICarOwnersRepository repository)
 {
     _repository = repository;
 }