@Zhi Lv - MSFT I saw that you helped before in this post (asp-net-core-embedded-resource-microsoft-identity-is-not-found-when-environm) but I couldn't find it on the Program.cs. Would you please guide me?
Program.cs
using IMS.Plugins.EFCore;
using IMS.UseCases;
using IMS.UseCases.Activities;
using IMS.UseCases.Customers;
using IMS.UseCases.Interfaces;
using IMS.UseCases.Inventories;
using IMS.UseCases.PluginInterfaces;
using IMS.USeCases.PluginInterfaces;
using IMS.UseCases.Products;
using IMS.UseCases.Reports;
using IMS.UseCases.Validations;
using IMS.UseCases.Vendors;
using IMS.WebApp.Areas.Identity;
using IMS.WebApp.Data;
using Microsoft.AspNetCore.Components.Authorization;
using Microsoft.AspNetCore.Identity;
using Microsoft.EntityFrameworkCore;
using IMS.UseCases.Interfaces.Customer;
using IMS.UseCases.Interfaces.Order;
using IMS.UseCases.Interfaces.OrderDetail;
using IMS.UseCases.Interfaces.Vendor;
using IMS.UseCases.OrderDetails;
using IMS.UseCases.Orders;
using Microsoft.Extensions.DependencyInjection.Extensions;
using NLog.Web;
using Radzen;
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
var connectionString = builder.Configuration.GetConnectionString("InventoryManagement");
builder.Services.AddDbContext<ApplicationDbContext>(options =>
options.UseSqlServer(connectionString));
builder.Services.AddDatabaseDeveloperPageExceptionFilter();
builder.Services.AddDefaultIdentity<IdentityUser>(options => options.SignIn.RequireConfirmedAccount = false)
.AddRoles<IdentityRole>()
.AddEntityFrameworkStores<ApplicationDbContext>();
builder.Services.AddRazorPages();
builder.Services.AddServerSideBlazor();
builder.Services.AddScoped<AuthenticationStateProvider, RevalidatingIdentityAuthenticationStateProvider<IdentityUser>>();
builder.Services.AddSingleton<WeatherForecastService>();
builder.Services.AddDbContextFactory<IMSContext>(options =>
{
options.UseSqlServer(builder.Configuration.GetConnectionString("InventoryManagement"));
}
);
//Radzen DialogService
builder.Services.AddScoped<DialogService>();
//DI Repo
builder.Services.AddTransient<IInventoryRepository, InventoryRepository>();
builder.Services.AddTransient<IProductRepository, ProductRepository>();
builder.Services.AddTransient<IInventoryTransactionRepository, InventoryTransactionRepository>();
builder.Services.AddTransient<IProductTransactionRepository, ProductTransactionRepository>();
builder.Services.AddTransient<IOrderDetailRepository, OrderDetailRepository>();
//vendors
builder.Services.AddTransient<IVendorRepository, VendorRepository>();
//Customers
builder.Services.AddTransient<ICustomerRepository, CustomerRepository>();
//Order
builder.Services.AddTransient<IOrderRepository, OrderRepository>();
//DI Use cases
builder.Services.AddTransient<IViewInventoriesByNameUseCase, ViewInventoriesByNameUseCase>();
builder.Services.AddTransient<IAddInventoryUseCase, AddInventoryUseCase>();
builder.Services.AddTransient<IEditInventoryUseCase, EditInventoryUseCase>();
builder.Services.AddTransient<IViewInventoryByIdUseCase, ViewInventoryByIdUseCase>();
builder.Services.AddTransient<IViewProductsByNameUseCase, ViewProductsByNameUseCase>();
builder.Services.AddTransient<IAddProductUseCase, AddProductUseCase>();
builder.Services.AddTransient<IViewProductByIdUseCase, ViewProductByIdUseCase>();
builder.Services.AddTransient<IEditProductUseCase, EditProductUseCase>();
builder.Services.AddTransient<IDeleteProductUseCase, DeleteProductUseCase>();
builder.Services.AddTransient<IPurchaseInventoryUseCase, PurchaseInventoryUseCase>();
builder.Services
.AddTransient<IValidateEnoughInventoriesForproducingUseCase, ValidateEnoughInventoriesForproducingUseCase>();
builder.Services.AddTransient<IProduceProductUsecase, ProduceProductUsecase>();
builder.Services.AddTransient<ISellProductUseCase, SellProductUseCase>();
builder.Services.AddTransient<ISearchInventoryTransactionsUseCase, SearchInventoryTransactionsUseCase>();
builder.Services.AddTransient<ISearchProductTransactionsUseCase, SearchProductTransactionsUseCase>();
//vendors
builder.Services.AddTransient<IViewVendorsByNameUseCase, ViewVendorsByNameUseCase>();
builder.Services.AddTransient<IAddVendorUseCase, AddVendorUseCase>();
builder.Services.AddTransient<IEditVendorUseCase, EditVendorUseCase>();
builder.Services.AddTransient<IViewVendorByIdUseCase, ViewVendorByIdUseCase>();
builder.Services.AddTransient<IViewAllVendorsUseCase, ViewAllVendorsUseCase>();
//customers
builder.Services.AddTransient<IAddCustomerUseCase, AddCustomerUseCase>();
builder.Services.AddTransient<IEditCustomerUseCase, EditCustomerUseCase>();
builder.Services.AddTransient<IViewCustomerByIdUseCase, ViewCustomerByIdUseCase>();
builder.Services.AddTransient<IViewCustomersByNameUseCase, ViewCustomersByNameUseCase>();
builder.Services.AddTransient<IViewAllCustomersUseCase, ViewAllCustomersUseCase>();
//orders
builder.Services.AddTransient<IAddOrderUseCase, AddOrderUseCase>();
builder.Services.AddTransient<IEditOrderUseCase, EditOrderUseCase>();
builder.Services.AddTransient<IViewOrderByIdUseCase, ViewOrderByIdUseCase>();
builder.Services.AddTransient<IViewOrdersByCustomerNameUseCase, ViewOrdersByCustomerNameUseCase>();
builder.Services.AddTransient<IViewAllOrdersUseCase, ViewAllOrdersUseCase>();
builder.Services.AddTransient<IAddOrderListUseCase, AddOrderListUseCase>();
builder.Services.AddTransient<IViewOrdersByStatusUseCase, ViewOrdersByStatusUseCase>();
builder.Services.AddTransient<ICancelOrderUseCase, CancelOrderUseCase>();
builder.Services.AddTransient<IAnnualStatusViewModel, AnnualStatusViewModel>();
builder.Services.AddTransient<IGetOrdersExportUseCase, GetOrdersExportUseCase>();
//order details
builder.Services.AddTransient<IAddOrderDetailUseCase, AddOrderDetailUseCase>();
builder.Services.AddTransient<IEditOrderDetailUseCase, EditOrderDetailUseCase>();
builder.Services.AddTransient<ICancelOrderDetailUseCase, CancelOrderDetailUseCase>();
builder.Services.AddTransient<IViewOrderDetailsByOrderIdUseCase, ViewOrderDetailsByOrderIdUseCase>();
builder.Services.AddTransient<IPassiveOrderDetailUseCase, PassiveOrderDetailUseCase>();
builder.Services.AddTransient<IDeleteOrderDetailByIdUseCase, DeleteOrderDetailByIdUseCase>();
//logging
builder.Logging.ClearProviders();
builder.Logging.AddConsole();
builder.Host.UseNLog();
//Aspnetcore_Environment
builder.WebHost.UseWebRoot("wwwroot");
builder.WebHost.UseStaticWebAssets();
var app = builder.Build();
var scope = app.Services.CreateScope();
var imsContext = scope.ServiceProvider.GetRequiredService<IMSContext>();
//imsContext.Database.EnsureDeleted();
//imsContext.Database.EnsureCreated();
// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
app.UseMigrationsEndPoint();
}
else
{
app.UseExceptionHandler("/Error");
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app.UseHsts();
}
app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseRouting();
app.UseAuthentication();
app.UseAuthorization();
app.MapControllers();
app.MapBlazorHub();
app.MapFallbackToPage("/_Host");
app.Run();