debug
This commit is contained in:
parent
d4aff05804
commit
7a9fcf9fc1
@ -6,6 +6,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<PackageReference Include="NetCorePal.Extensions.AspNetCore" />
|
||||||
<PackageReference Include="OpenIddict.Quartz" />
|
<PackageReference Include="OpenIddict.Quartz" />
|
||||||
<PackageReference Include="Swashbuckle.AspNetCore" />
|
<PackageReference Include="Swashbuckle.AspNetCore" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design">
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Design">
|
||||||
|
|||||||
26
Program.cs
26
Program.cs
@ -1,14 +1,18 @@
|
|||||||
|
using System.Reflection;
|
||||||
using Fengling.AuthService.Configuration;
|
using Fengling.AuthService.Configuration;
|
||||||
using Fengling.AuthService.Data;
|
using Fengling.AuthService.Data;
|
||||||
using Fengling.AuthService.Models;
|
using Fengling.AuthService.Models;
|
||||||
|
using Fengling.Platform.Infrastructure;
|
||||||
using Microsoft.AspNetCore.Authentication.Cookies;
|
using Microsoft.AspNetCore.Authentication.Cookies;
|
||||||
using Microsoft.AspNetCore.Identity;
|
using Microsoft.AspNetCore.Identity;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.OpenApi;
|
using Microsoft.OpenApi;
|
||||||
|
using NetCorePal.Extensions.DependencyInjection;
|
||||||
using OpenTelemetry;
|
using OpenTelemetry;
|
||||||
using OpenTelemetry.Resources;
|
using OpenTelemetry.Resources;
|
||||||
using OpenTelemetry.Trace;
|
using OpenTelemetry.Trace;
|
||||||
using Serilog;
|
using Serilog;
|
||||||
|
using SeedData = Fengling.AuthService.Data.SeedData;
|
||||||
|
|
||||||
var builder = WebApplication.CreateBuilder(args);
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
|
|
||||||
@ -27,6 +31,14 @@ builder.Services.AddDbContext<ApplicationDbContext>(options =>
|
|||||||
options.UseOpenIddict();
|
options.UseOpenIddict();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
builder.Services.AddDbContext<PlatformDbContext>(options =>
|
||||||
|
{
|
||||||
|
options.UseNpgsql(builder.Configuration.GetConnectionString("DefaultConnection"));
|
||||||
|
options.UseOpenIddict();
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
builder.Services.AddRazorPages();
|
builder.Services.AddRazorPages();
|
||||||
builder.Services.AddControllersWithViews();
|
builder.Services.AddControllersWithViews();
|
||||||
|
|
||||||
@ -52,15 +64,23 @@ builder.Services.AddOpenTelemetry()
|
|||||||
resource.AddService("Fengling.AuthService"))
|
resource.AddService("Fengling.AuthService"))
|
||||||
.WithTracing(tracing =>
|
.WithTracing(tracing =>
|
||||||
tracing.AddAspNetCoreInstrumentation()
|
tracing.AddAspNetCoreInstrumentation()
|
||||||
.AddHttpClientInstrumentation()
|
.AddHttpClientInstrumentation()
|
||||||
.AddSource("OpenIddict.Server.AspNetCore")
|
.AddSource("OpenIddict.Server.AspNetCore")
|
||||||
.AddOtlpExporter());
|
.AddOtlpExporter());
|
||||||
|
|
||||||
builder.Services.AddControllersWithViews();
|
builder.Services.AddControllersWithViews();
|
||||||
|
|
||||||
builder.Services.AddHealthChecks()
|
builder.Services.AddHealthChecks()
|
||||||
.AddNpgSql(builder.Configuration.GetConnectionString("DefaultConnection")!);
|
.AddNpgSql(builder.Configuration.GetConnectionString("DefaultConnection")!);
|
||||||
|
|
||||||
|
|
||||||
|
builder.Services.AddRepositories(typeof(ApplicationDbContext).Assembly, typeof(PlatformDbContext).Assembly);
|
||||||
|
builder.Services.AddMediatR(x => x.RegisterServicesFromAssemblies(typeof(PlatformDbContext).Assembly
|
||||||
|
, Assembly.GetExecutingAssembly())
|
||||||
|
.AddCommandLockBehavior()
|
||||||
|
.AddKnownExceptionValidationBehavior()
|
||||||
|
.AddUnitOfWorkBehaviors()
|
||||||
|
);
|
||||||
builder.Services.AddSwaggerGen(options =>
|
builder.Services.AddSwaggerGen(options =>
|
||||||
{
|
{
|
||||||
options.SwaggerDoc("v1", new OpenApiInfo
|
options.SwaggerDoc("v1", new OpenApiInfo
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user