|
|
|
@ -1,6 +1,7 @@
|
|
|
|
|
using System.Security.Claims;
|
|
|
|
|
using Asp.Versioning;
|
|
|
|
|
using Asp.Versioning.ApiExplorer;
|
|
|
|
|
using Infrastructure.Domains;
|
|
|
|
|
using Infrastructure.Filters;
|
|
|
|
|
using Infrastructure.HttpUserContext;
|
|
|
|
|
using Infrastructure.Options;
|
|
|
|
@ -318,7 +319,7 @@ public static class ServiceCollectionExtensions
|
|
|
|
|
IConfiguration configuration,
|
|
|
|
|
IWebHostEnvironment hostEnvironment,
|
|
|
|
|
List<ConnectionConfig>? connectionConfigs = null,
|
|
|
|
|
Action<object, DataFilterModel>? onDataChanging = null,
|
|
|
|
|
Action<object, DataFilterModel>? onDataExecuting = null,
|
|
|
|
|
Action<DiffLogModel>? onDiffLogEvent = null
|
|
|
|
|
)
|
|
|
|
|
{
|
|
|
|
@ -397,7 +398,24 @@ public static class ServiceCollectionExtensions
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
client.Aop.DataExecuting = onDataChanging;
|
|
|
|
|
onDataExecuting ??= (o, entityInfo) =>
|
|
|
|
|
{
|
|
|
|
|
if (entityInfo is
|
|
|
|
|
{
|
|
|
|
|
OperationType: DataFilterType.InsertByObject, PropertyName: nameof(IDateAbility.CreatedDate)
|
|
|
|
|
})
|
|
|
|
|
{
|
|
|
|
|
entityInfo.SetValue(DateTime.Now);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (entityInfo is
|
|
|
|
|
{ OperationType: DataFilterType.UpdateByObject, PropertyName: nameof(IDateAbility.UpdatedDate) })
|
|
|
|
|
{
|
|
|
|
|
entityInfo.SetValue(DateTime.Now);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
client.Aop.DataExecuting = onDataExecuting;
|
|
|
|
|
client.Aop.OnDiffLogEvent = onDiffLogEvent;
|
|
|
|
|
});
|
|
|
|
|
services.AddSingleton<ISqlSugarClient>(sugarScope);
|
|
|
|
|