public UnitOfWork(LocationDbContext dbContext, IMapper mapper, ILocationRepository locationRepository) { if (dbContext == null) { throw new ArgumentNullException("dbContext can not be null."); } _dbContext = dbContext; _mapper = mapper; _locationRepository = locationRepository; }
public void CanAddCitiesToLocationDb() { using (LocationDbContext db = new LocationDbContext()) { foreach (string city in JsonLocationReader.Cities()) { Location loc = new Location(city); db.locations.Add(loc); db.SaveChanges(); } } }
public PostgresIntegrationTest() { config = new ConfigurationBuilder() .SetBasePath(Directory.GetCurrentDirectory()) .AddEnvironmentVariables() .Build(); var connectionString = config.GetSection("postgres:cstr").Value; var optionsBuilder = new DbContextOptionsBuilder <LocationDbContext>(); optionsBuilder.UseNpgsql(connectionString); this.context = new LocationDbContext(optionsBuilder.Options); }
public PostgresIntegrationTest() { config = new ConfigurationBuilder() .SetBasePath(System.IO.Directory.GetCurrentDirectory()) .AddEnvironmentVariables() .Build(); //var connectionString = config.GetSection("postgres:url").Value; var connectionString = @"postgres://*****:*****@localhost:5432/locationservice"; var optionsBuilder = new DbContextOptionsBuilder <LocationDbContext>(); optionsBuilder.UseNpgsql(connectionString); this.context = new LocationDbContext(optionsBuilder.Options); }
public LocationRepository(LocationDbContext dbContext) { _dbContext = dbContext; }
public LocationService(LocationDbContext dbContext, IConfiguration configuration) { this.dbContext = dbContext; this.configuration = configuration; }
public TransactionBehaviour(LocationDbContext dbContext, ILogger <TransactionBehaviour <TRequest, TResponse> > logger) { _dbContext = dbContext ?? throw new ArgumentException(nameof(LocationDbContext)); _logger = logger ?? throw new ArgumentException(nameof(ILogger)); }
public CityRepository(LocationDbContext context) : base(context) { }
public LocationService(LocationDbContext locationDbContext) { _locationDbContext = locationDbContext; }
public LocationService(LocationDbContext dbContext) { _dbContext = dbContext; }
public LocationsController(LocationDbContext context) { _context = context; }
public RepositoryFactory(LocationDbContext context) { this.context = context; }
public BaseRepository(LocationDbContext context) { this.context = context; this.models = context.Set <TEntity>(); }
public AddUserLocationCommandHandler(LocationDbContext context, ILogger <AddUserLocationCommandHandler> logger) { _context = context; _logger = logger ?? throw new ArgumentNullException(nameof(logger)); }