This commit is contained in:
xuejiaming 2022-05-20 15:29:06 +08:00
parent 7c4b44a4c9
commit c4d2439c79
3 changed files with 3 additions and 4 deletions

View File

@ -61,7 +61,7 @@ namespace Sample.AutoCreateIfPresent
var tableName = dataTable.Rows[i][TABLE_NAME]?.ToString() ?? string.Empty;
if (tableName.StartsWith(CurrentTableName,StringComparison.OrdinalIgnoreCase))
{
//如果没有下划线那么需要CurrentTableName.Length
//如果没有下划线那么需要CurrentTableName.Length有下划线就要CurrentTableName.Length+1
_tails.TryAdd(tableName.Substring(CurrentTableName.Length+1), null);
}
}

View File

@ -51,7 +51,7 @@ public class WeatherForecastController : ControllerBase
}
public async Task<IActionResult> Query1()
{
var list = await _defaultDbContext.Set<AreaDevice>().Where(o=>o.Area=="x").ToListAsync();
var list = await _defaultDbContext.Set<AreaDevice>().ToListAsync();
return Ok(list);
}
public async Task<IActionResult> Insert1()

View File

@ -79,8 +79,7 @@ namespace Sample.AutoCreateIfPresent
var tableName = dataTable.Rows[i][TABLE_NAME]?.ToString()??string.Empty;
if (tableName.StartsWith(CurrentTableName, StringComparison.OrdinalIgnoreCase))
{
//如果没有下划线那么需要CurrentTableName.Length
var substring = tableName.Substring(CurrentTableName.Length+1);
//如果没有下划线那么需要CurrentTableName.Length有下划线就要CurrentTableName.Length+1
_tails.TryAdd(tableName.Substring(CurrentTableName.Length),null);
}
}