// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, VolvoContext context)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            InicializaDb.Initialize(context);
            app.UseMvc();
        }
Example #2
0
        private bool disposedValue = false; // To detect redundant calls

        public VolvoContext CreateContextForInMemory()
        {
            var option = new DbContextOptionsBuilder <VolvoContext>().UseInMemoryDatabase(databaseName: $"VolvoDbInMemory").Options;

            var context = new VolvoContext(option);

            if (context != null)
            {
                context.Database.EnsureDeleted();
                context.Database.EnsureCreated();
            }

            return(context);
        }
Example #3
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, VolvoContext volvoContext)
        {
            volvoContext.Database.Migrate();

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseSwagger();
                app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "Volvo.BFF v1"));
            }

            app.UseCors("MyPolicy");

            app.UseRouting();

            app.UseAuthorization();


            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllers();
            });
        }
Example #4
0
 public CaminhaoRepository(VolvoContext context) : base(context)
 {
     Context = context;
 }
Example #5
0
 public CaminhoesService(VolvoContext context)
 {
     _context = context;
 }
 public BaseRepository(VolvoContext context)
 {
     _context = context;
 }
Example #7
0
 public ModeloRepository(IConfiguration configuration, VolvoContext context)
 {
     _context       = context;
     _configuration = configuration;
 }
 public StatusRepository(VolvoContext context) : base(context)
 {
     Context = context;
 }
Example #9
0
 public CaminhaoRepository(IConfiguration configuration, VolvoContext context)
 {
     _context       = context;
     _configuration = configuration;
 }