|
|
@ -1,8 +1,10 @@
|
|
|
|
using API;
|
|
|
|
using API;
|
|
|
|
|
|
|
|
using Asp.Versioning;
|
|
|
|
using DbContextLib;
|
|
|
|
using DbContextLib;
|
|
|
|
using Microsoft.AspNetCore.Identity;
|
|
|
|
using Microsoft.AspNetCore.Identity;
|
|
|
|
using Microsoft.AspNetCore.Mvc.Versioning;
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
using Microsoft.OpenApi.Models;
|
|
|
|
using Microsoft.OpenApi.Models;
|
|
|
|
using Services;
|
|
|
|
using Services;
|
|
|
|
|
|
|
|
|
|
|
@ -19,7 +21,17 @@ builder.Services.AddDbContext<DbContext, UserDbContext>();
|
|
|
|
builder.Services.AddDbContext<WebAPIDbContext>(options => options.UseInMemoryDatabase("appDb"));
|
|
|
|
builder.Services.AddDbContext<WebAPIDbContext>(options => options.UseInMemoryDatabase("appDb"));
|
|
|
|
builder.Services.AddIdentityApiEndpoints<IdentityUser>().AddEntityFrameworkStores<WebAPIDbContext>();
|
|
|
|
builder.Services.AddIdentityApiEndpoints<IdentityUser>().AddEntityFrameworkStores<WebAPIDbContext>();
|
|
|
|
builder.Services.AddAuthorization();
|
|
|
|
builder.Services.AddAuthorization();
|
|
|
|
builder.Services.AddApiVersioning(o => o.ApiVersionReader = new HeaderApiVersionReader("api-version"));
|
|
|
|
builder.Services.AddApiVersioning(o =>
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
o.AssumeDefaultVersionWhenUnspecified = true;
|
|
|
|
|
|
|
|
o.DefaultApiVersion = new ApiVersion(1);
|
|
|
|
|
|
|
|
o.ReportApiVersions = true;
|
|
|
|
|
|
|
|
}).AddApiExplorer(
|
|
|
|
|
|
|
|
options =>
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
options.GroupNameFormat = "'v'VVV";
|
|
|
|
|
|
|
|
options.SubstituteApiVersionInUrl = true;
|
|
|
|
|
|
|
|
});
|
|
|
|
//builder.Services.AddIdentityApiEndpoints<IdentityUser>()
|
|
|
|
//builder.Services.AddIdentityApiEndpoints<IdentityUser>()
|
|
|
|
// .AddEntityFrameworkStores<UserDbContext>();
|
|
|
|
// .AddEntityFrameworkStores<UserDbContext>();
|
|
|
|
builder.Services.AddSwaggerGen(option =>
|
|
|
|
builder.Services.AddSwaggerGen(option =>
|
|
|
|