![]() Private readonly ProductContext _context Right after that, let’s modify the ProductRepository class: public class ProductRepository : IProductRepository Learning Web API? Get our eBook ASP.NET Core Web API Best Practices and become an expert for FREE! > GET THE BOOK > GetProducts() The app.UseCors method should be used in the same place below the app.UseHttpsRedirection method. That said, we have to use method to register CORS, and of course, method to register DbContext right below the comment that states where should we register our services to the container. NET version, we don’t have these two methods, and we use only the Program class: var builder = WebApplication.CreateBuilder(args) Public void Configure(IApplicationBuilder app, IWebHostEnvironment env) ![]() Services.AddDbContext(opt => opt.UseSqlServer(Configuration.GetConnectionString("sqlConnection"))) Policy.AddPolicy("CorsPolicy", opt => opt Public void ConfigureServices(IServiceCollection services) ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |