添加abp并发字段在读写分离和分库分表时出现的bug
This commit is contained in:
parent
e9432cb899
commit
4adf709f56
|
@ -71,7 +71,7 @@ namespace Sample.MySql
|
||||||
|
|
||||||
|
|
||||||
services.AddShardingDbContext<DefaultShardingDbContext>()
|
services.AddShardingDbContext<DefaultShardingDbContext>()
|
||||||
.UseRouteConfig(o =>
|
.UseRouteConfig((sp,o) =>
|
||||||
{
|
{
|
||||||
o.AddShardingTableRoute<DynamicTableRoute>();
|
o.AddShardingTableRoute<DynamicTableRoute>();
|
||||||
o.AddShardingTableRoute<SysUserLogByMonthRoute>();
|
o.AddShardingTableRoute<SysUserLogByMonthRoute>();
|
||||||
|
|
|
@ -5,9 +5,11 @@ using System;
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
|
using Microsoft.EntityFrameworkCore.ChangeTracking;
|
||||||
using ShardingCore.EFCores;
|
using ShardingCore.EFCores;
|
||||||
using ShardingCore.Sharding.ShardingDbContextExecutors;
|
using ShardingCore.Sharding.ShardingDbContextExecutors;
|
||||||
using Volo.Abp.Domain.Entities;
|
using Volo.Abp.Domain.Entities;
|
||||||
|
using Volo.Abp.Domain.Entities.Events;
|
||||||
using Volo.Abp.EntityFrameworkCore;
|
using Volo.Abp.EntityFrameworkCore;
|
||||||
using Volo.Abp.Reflection;
|
using Volo.Abp.Reflection;
|
||||||
|
|
||||||
|
@ -101,6 +103,32 @@ namespace Samples.AbpSharding
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// /// <summary>
|
||||||
|
// /// abp 5.x+ 如果存在并发字段那么需要添加这段代码
|
||||||
|
// /// </summary>
|
||||||
|
// protected override void HandlePropertiesBeforeSave()
|
||||||
|
// {
|
||||||
|
// if (GetShardingExecutor() == null)
|
||||||
|
// {
|
||||||
|
// base.HandlePropertiesBeforeSave();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
// /// <summary>
|
||||||
|
// /// abp 4.x+ 如果存在并发字段那么需要添加这段代码
|
||||||
|
// /// </summary>
|
||||||
|
// /// <returns></returns>
|
||||||
|
//
|
||||||
|
// protected override void ApplyAbpConcepts(EntityEntry entry, EntityChangeReport changeReport)
|
||||||
|
// {
|
||||||
|
// if (GetShardingExecutor() == null)
|
||||||
|
// {
|
||||||
|
// base.ApplyAbpConcepts(entry, changeReport);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
public override void Dispose()
|
public override void Dispose()
|
||||||
{
|
{
|
||||||
_shardingDbContextExecutor?.Dispose();
|
_shardingDbContextExecutor?.Dispose();
|
||||||
|
|
Loading…
Reference in New Issue