i'm not sure what i'm doing

This commit is contained in:
Вячеслав 2025-03-25 22:56:35 +05:00
parent 950babb68c
commit 35331a87f1
7 changed files with 41 additions and 13 deletions

View file

@ -1,3 +1,8 @@
using Microsoft.AspNetCore.Identity;
using Microsoft.EntityFrameworkCore;
using SurveyBackend.Core.Models;
using SurveyBackend.Infrastructure.Data;
namespace SurveyBackend;
public class Program
@ -8,7 +13,16 @@ public class Program
// Add services to the container.
builder.Services.AddAuthorization();
builder.Services.AddDbContext<DataContext>(options =>
{
options.UseSqlite(builder.Configuration.GetConnectionString("DefaultConnection"));
});
builder.Services.AddIdentity<User, IdentityRole<int>>(options => { })
.AddEntityFrameworkStores<DataContext>()
.AddDefaultTokenProviders();
builder.Services.AddControllers();
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
@ -25,9 +39,9 @@ public class Program
}
app.UseAuthorization();
app.MapControllers();
app.Run();
}
}

View file

@ -9,7 +9,13 @@
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.2"/>
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="9.0.3" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0"/>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\SurveyBackend.Core\SurveyBackend.Core.csproj" />
<ProjectReference Include="..\SurveyBackend.Infrastructure\SurveyBackend.Infrastructure.csproj" />
</ItemGroup>
</Project>

View file

@ -4,5 +4,8 @@
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"ConnectionStrings": {
"DefaultConnection": "Data Source=Application.db"
}
}

View file

@ -5,5 +5,8 @@
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*"
"AllowedHosts": "*",
"ConnectionStrings": {
"DefaultConnection": "Data Source=Application.db"
}
}