Compare commits
No commits in common. "19ebd117bc088039e107e40badd74883eb3636b7" and "7cb177cb7c42d32a3b95f64f958f974c772d6a98" have entirely different histories.
19ebd117bc
...
7cb177cb7c
|
|
@ -95,11 +95,8 @@ builder.Services.AddControllers(options =>
|
||||||
})
|
})
|
||||||
.AddNewtonsoftJsonSetup(builder.Services); // NewtonsoftJson 序列化 处理
|
.AddNewtonsoftJsonSetup(builder.Services); // NewtonsoftJson 序列化 处理
|
||||||
|
|
||||||
// Panda动态WebApi + UnifiedApiResultFilter + 省掉控制器代码
|
//动态WebApi + UnifiedApiResultFilter 省掉控制器代码
|
||||||
builder.Services.AddDynamicWebApiSetup();
|
builder.Services.AddDynamicWebApiSetup();
|
||||||
//MinimalAPI
|
|
||||||
builder.Services.AddMasaMinimalAPIs();
|
|
||||||
|
|
||||||
//AutoMapper
|
//AutoMapper
|
||||||
builder.Services.AddAutoMapperSetup();
|
builder.Services.AddAutoMapperSetup();
|
||||||
//EF ORM QueryWithNoLock
|
//EF ORM QueryWithNoLock
|
||||||
|
|
@ -129,8 +126,32 @@ builder.Services.AddDicomSetup();
|
||||||
// 实时应用
|
// 实时应用
|
||||||
builder.Services.AddSignalR();
|
builder.Services.AddSignalR();
|
||||||
|
|
||||||
|
//MinimalAPI
|
||||||
|
builder.Services.AddMasaMinimalAPIs(options =>
|
||||||
|
{
|
||||||
|
options.Prefix = "";//自定义前缀 默认是api
|
||||||
|
options.Version = ""; //默认是V1
|
||||||
|
options.AutoAppendId = false; //路由是否自动附加参数Id 默认是true
|
||||||
|
options.PluralizeServiceName = false; //服务名称是否启用复数
|
||||||
|
|
||||||
|
//options.Assemblies = new List<Assembly>() { typeof(UserSiteSurveySubmitedEventConsumer).Assembly };
|
||||||
|
|
||||||
|
options.GetPrefixes = new List<string> { "Get", "Select", "Find" };
|
||||||
|
options.PostPrefixes = new List<string> { "Post", "Add", "Create", "List" };
|
||||||
|
options.PutPrefixes = new List<string> { "Put", "Update" };
|
||||||
|
options.DeletePrefixes = new List<string> { "Delete", "Remove" };
|
||||||
|
|
||||||
|
options.RouteHandlerBuilder= t=> {
|
||||||
|
t.RequireAuthorization()
|
||||||
|
.AddEndpointFilter<LimitUserRequestAuthorizationEndpointFilter>()
|
||||||
|
//.AddEndpointFilter<ModelValidationEndpointFilter>()
|
||||||
|
.AddEndpointFilter<UnifiedApiResultEndpointFilter>()
|
||||||
|
.WithGroupName("Institution").DisableAntiforgery();
|
||||||
|
};
|
||||||
|
options.MapHttpMethodsForUnmatched = new string[] { "Post" };
|
||||||
|
options.DisableTrimMethodPrefix = true; //禁用去除方法前缀
|
||||||
|
options.DisableAutoMapRoute = false;//可通过配置true禁用全局自动路由映射或者删除此配置以启用全局自动路由映射
|
||||||
|
});
|
||||||
|
|
||||||
//// 添加反伪造服务
|
//// 添加反伪造服务
|
||||||
//builder.Services.AddAntiforgery(options =>
|
//builder.Services.AddAntiforgery(options =>
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,9 @@
|
||||||
using IRaCIS.Core.Application.Service.BusinessFilter;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.AspNetCore.Builder;
|
|
||||||
using Microsoft.AspNetCore.Http;
|
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
|
||||||
using Panda.DynamicWebApi;
|
using Panda.DynamicWebApi;
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace IRaCIS.Core.API
|
namespace IRaCIS.Core.API
|
||||||
{
|
{
|
||||||
public static class WebApiSetup
|
public static class DynamicWebApiSetup
|
||||||
{
|
{
|
||||||
//20210910 避免冗余的控制器层代码编写,仅仅包了一层前后台定义的格式 这里采用动态webAPi+IResultFilter 替代大部分情况
|
//20210910 避免冗余的控制器层代码编写,仅仅包了一层前后台定义的格式 这里采用动态webAPi+IResultFilter 替代大部分情况
|
||||||
public static void AddDynamicWebApiSetup(this IServiceCollection services)
|
public static void AddDynamicWebApiSetup(this IServiceCollection services)
|
||||||
|
|
@ -24,37 +20,5 @@ namespace IRaCIS.Core.API
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void AddMasaMinimalAPiSetUp(this IServiceCollection services)
|
|
||||||
{
|
|
||||||
services.AddMasaMinimalAPIs(options =>
|
|
||||||
{
|
|
||||||
options.Prefix = "";//自定义前缀 默认是api
|
|
||||||
options.Version = ""; //默认是V1
|
|
||||||
options.AutoAppendId = false; //路由是否自动附加参数Id 默认是true
|
|
||||||
options.PluralizeServiceName = false; //服务名称是否启用复数
|
|
||||||
|
|
||||||
//options.Assemblies = new List<Assembly>() { typeof(UserSiteSurveySubmitedEventConsumer).Assembly };
|
|
||||||
|
|
||||||
options.GetPrefixes = new List<string> { "Get", "Select", "Find" };
|
|
||||||
options.PostPrefixes = new List<string> { "Post", "Add", "Create", "List" };
|
|
||||||
options.PutPrefixes = new List<string> { "Put", "Update" };
|
|
||||||
options.DeletePrefixes = new List<string> { "Delete", "Remove" };
|
|
||||||
|
|
||||||
options.RouteHandlerBuilder = t => {
|
|
||||||
t.RequireAuthorization()
|
|
||||||
.AddEndpointFilter<LimitUserRequestAuthorizationEndpointFilter>()
|
|
||||||
//.AddEndpointFilter<ModelValidationEndpointFilter>()
|
|
||||||
.AddEndpointFilter<UnifiedApiResultEndpointFilter>()
|
|
||||||
.WithGroupName("Institution").DisableAntiforgery();
|
|
||||||
};
|
|
||||||
options.MapHttpMethodsForUnmatched = new string[] { "Post" };
|
|
||||||
options.DisableTrimMethodPrefix = true; //禁用去除方法前缀
|
|
||||||
options.DisableAutoMapRoute = false;//可通过配置true禁用全局自动路由映射或者删除此配置以启用全局自动路由映射
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -51,6 +51,7 @@ namespace IRaCIS.Core.API
|
||||||
//迁移的时候,不生成外键
|
//迁移的时候,不生成外键
|
||||||
options.ReplaceService<IMigrationsSqlGenerator, NoForeignKeyMigrationsSqlGenerator>();
|
options.ReplaceService<IMigrationsSqlGenerator, NoForeignKeyMigrationsSqlGenerator>();
|
||||||
|
|
||||||
|
|
||||||
options.UseLoggerFactory(logFactory);
|
options.UseLoggerFactory(logFactory);
|
||||||
|
|
||||||
options.UseExceptionProcessor();
|
options.UseExceptionProcessor();
|
||||||
|
|
@ -62,6 +63,10 @@ namespace IRaCIS.Core.API
|
||||||
|
|
||||||
options.UseProjectables();
|
options.UseProjectables();
|
||||||
|
|
||||||
|
//options.AddInterceptors(new AuditingInterceptor(configuration.GetSection("ConnectionStrings:RemoteNew").Value));
|
||||||
|
|
||||||
|
//options.UseTriggers(triggerOptions => triggerOptions.AddTrigger<SubjectVisitImageDateTrigger>());
|
||||||
|
|
||||||
//options.UseTriggers(triggerOptions => triggerOptions.AddAssemblyTriggers(typeof(SubjectVisitTrigger).Assembly));
|
//options.UseTriggers(triggerOptions => triggerOptions.AddAssemblyTriggers(typeof(SubjectVisitTrigger).Assembly));
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -79,7 +84,13 @@ namespace IRaCIS.Core.API
|
||||||
|
|
||||||
triggerOptions.AddTrigger<UserLogTrigger>();
|
triggerOptions.AddTrigger<UserLogTrigger>();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Register an additional context factory as a Scoped service, which gets a pooled context from the Singleton factory we registered above,
|
// Register an additional context factory as a Scoped service, which gets a pooled context from the Singleton factory we registered above,
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ namespace IRaCIS.Core.API
|
||||||
public static void AddMassTransitSetup(this IServiceCollection services)
|
public static void AddMassTransitSetup(this IServiceCollection services)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
#region MassTransit
|
#region MassTransit
|
||||||
//masstransit组件 也支持MediatR 中介者模式,但是支持分布式,考虑后续,所以在次替代MediatR
|
//masstransit组件 也支持MediatR 中介者模式,但是支持分布式,考虑后续,所以在次替代MediatR
|
||||||
//参考链接:https://masstransit.io/documentation/concepts/mediator#scoped-mediator
|
//参考链接:https://masstransit.io/documentation/concepts/mediator#scoped-mediator
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue