修改了一下启动的默认是否启用读写分离

This commit is contained in:
xuejiaming 2021-12-28 09:46:33 +08:00
parent 9acbe8d42d
commit fbe7207b86
3 changed files with 3 additions and 1 deletions

View File

@ -7,5 +7,6 @@ namespace Sample.SqlServerShardingTable.Entities
public long Id { get; set; }
public string Name { get; set; }
public DateTime CreateTime { get; set; }
public bool IsDelete { get; set; }
}
}

View File

@ -45,6 +45,7 @@ namespace Sample.SqlServerShardingTable
entity.HasKey(o => o.Id);
entity.Property(o => o.Id).ValueGeneratedNever();
entity.Property(o=>o.Name).IsRequired().IsUnicode(false).HasMaxLength(50);
entity.HasQueryFilter(o => o.IsDelete == false);
entity.ToTable(nameof(MultiShardingOrder));
});
}

View File

@ -84,7 +84,7 @@ namespace ShardingCore.Test
}
}
};
},ReadStrategyEnum.Loop,readConnStringGetStrategy:ReadConnStringGetStrategyEnum.LatestEveryTime)
},ReadStrategyEnum.Loop,defaultEnable: false, readConnStringGetStrategy:ReadConnStringGetStrategyEnum.LatestEveryTime)
.AddTableEnsureManager(sp=>new SqlServerTableEnsureManager<ShardingDefaultDbContext>())
.End();
// services.AddShardingDbContext<ShardingDefaultDbContext, DefaultDbContext>(o => o.UseMySql(hostBuilderContext.Configuration.GetSection("MySql")["ConnectionString"],new MySqlServerVersion("5.7.15"))