添加路由说明
This commit is contained in:
parent
f6e669a442
commit
f214578e60
|
@ -38,7 +38,11 @@ namespace Sample.AutoCreateIfPresent
|
|||
{
|
||||
return $"{shardingKey}";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 如果你是非mysql数据库请自行实现这个方法返回当前类在数据库已经存在的后缀
|
||||
/// 仅启动时调用
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public override List<string> GetAllTails()
|
||||
{
|
||||
//启动寻找有哪些表后缀
|
||||
|
|
|
@ -51,7 +51,7 @@ public class WeatherForecastController : ControllerBase
|
|||
}
|
||||
public async Task<IActionResult> Query1()
|
||||
{
|
||||
var list = await _defaultDbContext.Set<AreaDevice>().ToListAsync();
|
||||
var list = await _defaultDbContext.Set<AreaDevice>().Where(o=>o.Area=="x").ToListAsync();
|
||||
return Ok(list);
|
||||
}
|
||||
public async Task<IActionResult> Insert1()
|
||||
|
|
|
@ -56,6 +56,11 @@ namespace Sample.AutoCreateIfPresent
|
|||
return ShardingKeyFormat(dateTime);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 如果你是非mysql数据库请自行实现这个方法返回当前类在数据库已经存在的后缀
|
||||
/// 仅启动时调用
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public override List<string> GetAllTails()
|
||||
{
|
||||
//启动寻找有哪些表后缀
|
||||
|
|
|
@ -21,6 +21,7 @@ builder.Services.AddSwaggerGen();
|
|||
builder.Services.AddShardingDbContext<DefaultDbContext>()
|
||||
.AddEntityConfig(o =>
|
||||
{
|
||||
o.ThrowIfQueryRouteNotMatch = false;
|
||||
o.CreateShardingTableOnStart = true;
|
||||
o.EnsureCreatedWithOutShardingTable = true;
|
||||
o.AddShardingTableRoute<OrderByHourRoute>();
|
||||
|
|
|
@ -1,28 +1,12 @@
|
|||
{
|
||||
"$schema": "https://json.schemastore.org/launchsettings.json",
|
||||
"iisSettings": {
|
||||
"windowsAuthentication": false,
|
||||
"anonymousAuthentication": true,
|
||||
"iisExpress": {
|
||||
"applicationUrl": "http://localhost:26918",
|
||||
"sslPort": 44347
|
||||
}
|
||||
},
|
||||
"profiles": {
|
||||
"Sample.AutoCreateIfPresent": {
|
||||
"commandName": "Project",
|
||||
"dotnetRunMessages": true,
|
||||
"launchBrowser": true,
|
||||
"launchUrl": "swagger",
|
||||
"applicationUrl": "https://localhost:7066;http://localhost:5218",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"IIS Express": {
|
||||
"commandName": "IISExpress",
|
||||
"launchBrowser": true,
|
||||
"launchUrl": "swagger",
|
||||
"applicationUrl": "http://localhost:5000",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
|
|
|
@ -39,6 +39,7 @@ namespace Sample.SqlServer
|
|||
services.AddShardingDbContext<DefaultShardingDbContext>()
|
||||
.AddEntityConfig(o =>
|
||||
{
|
||||
o.ThrowIfQueryRouteNotMatch = false;
|
||||
o.CreateShardingTableOnStart = true;
|
||||
o.EnsureCreatedWithOutShardingTable = true;
|
||||
o.AddShardingTableRoute<SysUserModVirtualTableRoute>();
|
||||
|
|
Loading…
Reference in New Issue