not working inventory :c

This commit is contained in:
2025-02-04 17:47:18 -03:00
parent f234b5d84d
commit 7a2c3d2f67
22 changed files with 2713 additions and 49 deletions
+17 -1
View File
@@ -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");