not working inventory :c
This commit is contained in:
+17
-1
@@ -24,13 +24,22 @@ namespace PetCompanion
|
||||
// Configure Entity Framework Core
|
||||
var connectionString = builder.Configuration.GetConnectionString("DefaultConnection");
|
||||
builder.Services.AddDbContext<ApplicationDbContext>(options =>
|
||||
options.UseSqlite(connectionString));
|
||||
{
|
||||
options.UseSqlite(connectionString);
|
||||
options.EnableSensitiveDataLogging();
|
||||
});
|
||||
|
||||
builder.Services.AddScoped<PetClassRepository>();
|
||||
builder.Services.AddScoped<PetClassService>();
|
||||
builder.Services.AddScoped<SkillService>();
|
||||
builder.Services.AddScoped<GameItemsRepository>();
|
||||
builder.Services.AddScoped<GameItemService>();
|
||||
builder.Services.AddScoped<PetRepository>();
|
||||
builder.Services.AddScoped<PetService>();
|
||||
builder.Services.AddScoped<PetSkillRepository>();
|
||||
builder.Services.AddScoped<PetInventoryRepository>();
|
||||
builder.Services.AddScoped<PetSkillService>();
|
||||
builder.Services.AddScoped<PetInventoryService>();
|
||||
|
||||
// Add CORS policy
|
||||
builder.Services.AddCors(options =>
|
||||
@@ -55,6 +64,13 @@ namespace PetCompanion
|
||||
app.UseHttpsRedirection();
|
||||
app.UseAuthorization();
|
||||
|
||||
// After app builder is created
|
||||
using (var scope = app.Services.CreateScope())
|
||||
{
|
||||
var itemService = scope.ServiceProvider.GetRequiredService<GameItemService>();
|
||||
itemService.LoadItemsFromCsv("GameItemsData.csv");
|
||||
}
|
||||
|
||||
// Use CORS policy
|
||||
app.UseCors("AllowAll");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user