chore: ef In-Memory-Datenbank hinzugefügt und Dienst hinzugefügt
This commit is contained in:
parent
67a4e91a1b
commit
aeb1c4a810
@ -9,6 +9,7 @@
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.OData" Version="9.1.3" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.1" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="9.0.1" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
using DigitalData.Swagger.MockAPI.Data;
|
||||
using DigitalData.Swagger.MockAPI.Dtos;
|
||||
using DigitalData.Swagger.MockAPI.Repos;
|
||||
using Microsoft.AspNetCore.OData;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.OData.ModelBuilder;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
@ -12,6 +14,8 @@ builder.Services.AddSingleton<ICompanyRepo, CompanyRepo>();
|
||||
ODataConventionModelBuilder oDataModelbuilder = new();
|
||||
oDataModelbuilder.EntitySet<Company>("Companies");
|
||||
|
||||
builder.Services.AddDbContext<ApiContext>(opt => opt.UseInMemoryDatabase(databaseName: "CompaniesDB"));
|
||||
|
||||
builder.Services.AddControllers()
|
||||
.AddOData(options => options
|
||||
.AddRouteComponents("odata", oDataModelbuilder.GetEdmModel())
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user