diff --git a/build/version.props b/build/version.props
index 1ff9868d6..02ead273f 100644
--- a/build/version.props
+++ b/build/version.props
@@ -2,7 +2,7 @@
7
1
- 67
+ 68
$(VersionMajor).$(VersionMinor).$(VersionPatch)
diff --git a/src/Util.Aop.AspectCore/AppBuilderExtensions.cs b/src/Util.Aop.AspectCore/AppBuilderExtensions.cs
index 227d05f6d..dfc53b9c4 100644
--- a/src/Util.Aop.AspectCore/AppBuilderExtensions.cs
+++ b/src/Util.Aop.AspectCore/AppBuilderExtensions.cs
@@ -1,5 +1,4 @@
using Util.Configs;
-using Util.Helpers;
namespace Util.Aop;
@@ -24,13 +23,22 @@ public static IAppBuilder AddAop( this IAppBuilder builder,bool isEnableIAopProx
return builder.AddAop( null, isEnableIAopProxy );
}
+ ///
+ /// 启用AspectCore拦截器
+ ///
+ /// 应用生成器
+ /// AspectCore拦截器配置操作
+ public static IAppBuilder AddAop( this IAppBuilder builder, Action setupAction ) {
+ return builder.AddAop( setupAction, false );
+ }
+
///
/// 启用AspectCore拦截器
///
/// 应用生成器
/// AspectCore拦截器配置操作
/// 是否启用IAopProxy接口标记
- public static IAppBuilder AddAop( this IAppBuilder builder, Action setupAction, bool isEnableIAopProxy ) {
+ private static IAppBuilder AddAop( this IAppBuilder builder, Action setupAction, bool isEnableIAopProxy ) {
builder.CheckNull( nameof( builder ) );
builder.Host.UseServiceProviderFactory( new DynamicProxyServiceProviderFactory() );
builder.Host.ConfigureServices( ( context, services ) => {
@@ -61,8 +69,6 @@ private static bool IsProxy( Type type, bool isEnableIAopProxy ) {
if ( type == null )
return false;
if ( isEnableIAopProxy == false ) {
- if ( Reflection.GetTopBaseType( type ).SafeString() == "Microsoft.EntityFrameworkCore.DbContext" )
- return false;
if ( type.SafeString().Contains( "Xunit.DependencyInjection.ITestOutputHelperAccessor" ) )
return false;
return true;
@@ -78,7 +84,7 @@ private static bool IsProxy( Type type, bool isEnableIAopProxy ) {
}
///
- /// 注册拦截作用域
+ /// 注册拦截器服务
///
private static void RegisterAspectScoped( IServiceCollection services ) {
services.AddScoped();
diff --git a/src/Util.Application.EntityFrameworkCore/CrudServiceBase.cs b/src/Util.Application.EntityFrameworkCore/CrudServiceBase.cs
index 3c4e073e6..ce7bf7ecf 100644
--- a/src/Util.Application.EntityFrameworkCore/CrudServiceBase.cs
+++ b/src/Util.Application.EntityFrameworkCore/CrudServiceBase.cs
@@ -136,6 +136,8 @@ protected CrudServiceBase( IServiceProvider serviceProvider, IUnitOfWork unitOfW
///
public virtual async Task CreateAsync( TCreateRequest request ) {
+ request.CheckNull( nameof(request) );
+ request.Validate();
var entity = ToEntity( request );
entity.CheckNull( nameof( entity ) );
await CreateAsync( entity );
@@ -199,6 +201,8 @@ protected virtual Task CreateCommitAfterAsync( TEntity entity ) {
///
public virtual async Task UpdateAsync( TUpdateRequest request ) {
+ request.CheckNull( nameof(request) );
+ request.Validate();
if ( request.Id.IsEmpty() )
throw new InvalidOperationException( R.IdIsEmpty );
var oldEntity = await FindOldEntityAsync( request.Id );
diff --git a/src/Util.Application.EntityFrameworkCore/Trees/TreeServiceBase.cs b/src/Util.Application.EntityFrameworkCore/Trees/TreeServiceBase.cs
index 91725e2ae..1b5bb6839 100644
--- a/src/Util.Application.EntityFrameworkCore/Trees/TreeServiceBase.cs
+++ b/src/Util.Application.EntityFrameworkCore/Trees/TreeServiceBase.cs
@@ -112,6 +112,8 @@ protected TreeServiceBase( IServiceProvider serviceProvider, IUnitOfWork unitOfW
///
/// 创建参数
public virtual async Task CreateAsync( TCreateRequest request ) {
+ request.CheckNull( nameof( request ) );
+ request.Validate();
var entity = ToEntity( request );
entity.CheckNull( nameof( entity ) );
await CreateAsync( entity );
@@ -177,6 +179,8 @@ protected virtual Task CreateCommitAfterAsync( TEntity entity ) {
///
public virtual async Task UpdateAsync( TUpdateRequest request ) {
+ request.CheckNull( nameof( request ) );
+ request.Validate();
if ( request.Id.IsEmpty() )
throw new InvalidOperationException( R.IdIsEmpty );
var oldEntity = await FindOldEntityAsync( request.Id );
diff --git a/src/Util.Application/ICrudService.cs b/src/Util.Application/ICrudService.cs
index a8e3ae069..4946ab5c9 100644
--- a/src/Util.Application/ICrudService.cs
+++ b/src/Util.Application/ICrudService.cs
@@ -1,7 +1,5 @@
-using Util.Aop;
-using Util.Applications.Dtos;
+using Util.Applications.Dtos;
using Util.Data.Queries;
-using Util.Validation;
namespace Util.Applications;
@@ -31,12 +29,12 @@ public interface ICrudService
/// 创建参数
- Task CreateAsync( [NotNull] [Valid] TCreateRequest request );
+ Task CreateAsync( TCreateRequest request );
///
/// 修改
///
/// 修改参数
- Task UpdateAsync( [NotNull] [Valid] TUpdateRequest request );
+ Task UpdateAsync( TUpdateRequest request );
///
/// 删除
///
diff --git a/src/Util.Application/Trees/ITreeService.cs b/src/Util.Application/Trees/ITreeService.cs
index ea6fa6854..4e04a888c 100644
--- a/src/Util.Application/Trees/ITreeService.cs
+++ b/src/Util.Application/Trees/ITreeService.cs
@@ -1,7 +1,5 @@
-using Util.Aop;
-using Util.Applications.Dtos;
+using Util.Applications.Dtos;
using Util.Data.Trees;
-using Util.Validation;
namespace Util.Applications.Trees;
@@ -31,12 +29,12 @@ public interface ITreeService
/// 创建参数
- Task CreateAsync( [NotNull][Valid] TCreateRequest request );
+ Task CreateAsync( TCreateRequest request );
///
/// 修改
///
/// 修改参数
- Task UpdateAsync( [NotNull][Valid] TUpdateRequest request );
+ Task UpdateAsync( TUpdateRequest request );
///
/// 删除
///