Example #1
0
 public void RetrieveCoverV2()
 {
     using (var _dbContext = new CarInsuranceV3Context())
     {
         var coverRetrieved = _dbContext.Covers.Where(c =>
                                                      c.CoverBrokerRefId.Equals(_testedBrokerGuid) && c.Type.Equals("Accidents")).FirstOrDefault();
     }
 }
Example #2
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            string connectionString = "Server=.\\SQLExpress;Database=CarInsuranceV3;Trusted_Connection=True;";

            services.AddDbContext <CarInsuranceV3Context>(option => option.UseSqlServer(connectionString));

            ServiceProvider       serviceProvider = services.BuildServiceProvider();
            CarInsuranceV3Context appDbContext    = serviceProvider.GetService <CarInsuranceV3Context>();

            services.RegisterYourLibrary(appDbContext);

            services.AddControllers();
            services.AddScoped <ICoverRepository, CoverRepository>();
        }
Example #3
0
 public CoverRepository(CarInsuranceV3Context dbContext)
 {
     _dbContext = dbContext;
 }