Merge remote-tracking branch 'origin/x.5.x.x' into x.5.x.x

This commit is contained in:
xuejiaming 2022-07-04 23:50:09 +08:00
commit 1fac8aa592
3 changed files with 19 additions and 11 deletions

View File

@ -1,9 +1,9 @@
:start :start
::定义版本 ::定义版本
set EFCORE2=2.5.0.14 set EFCORE2=2.5.0.15
set EFCORE3=3.5.0.14 set EFCORE3=3.5.0.15
set EFCORE5=5.5.0.14 set EFCORE5=5.5.0.15
set EFCORE6=6.5.0.14 set EFCORE6=6.5.0.15
::删除所有bin与obj下的文件 ::删除所有bin与obj下的文件
@echo off @echo off

View File

@ -95,7 +95,15 @@ namespace Sample.SqlServer.Controllers
// }; // };
//var listAsync = await sql.ToListAsync(); //var listAsync = await sql.ToListAsync();
//var resultx112331tt = await _defaultTableDbContext.Set<SysTest>().AsNoTracking().CountAsync(); //var resultx112331tt = await _defaultTableDbContext.Set<SysTest>().AsNoTracking().CountAsync();
var resultx112331tt11234 = await _defaultTableDbContext.Set<SysTest>().Skip(2).MaxAsync(o=>o.Id);
var resultx112331tt1123 = await _defaultTableDbContext.Set<SysTest>().Skip(2).Take(2).ToListAsync();
var resultx112331tt1124 = await _defaultTableDbContext.Set<SysTest>().Take(2).Skip(2).ToListAsync();
var resultx112331tt112 = await _defaultTableDbContext.Set<SysUserMod>().FirstOrDefaultAsync(); var resultx112331tt112 = await _defaultTableDbContext.Set<SysUserMod>().FirstOrDefaultAsync();
var resultx112331tt2x1 = await _defaultTableDbContext.Set<SysTest>().OrderBy(o => o.Id).LastOrDefaultAsync();
var resultx112331tt2x1x = await _defaultTableDbContext.Set<SysTest>().OrderBy(o => o.Id).SingleOrDefaultAsync();
var resultx112331tt2x = await _defaultTableDbContext.Set<SysTest>().OrderBy(o => o.Id).Skip(2).LastOrDefaultAsync();
Console.WriteLine("--------------");
var resultx112331tt2y = await _defaultTableDbContext.Set<SysTest>().OrderBy(o => o.Id).Skip(2).OrderByDescending(o => o.Id).FirstOrDefaultAsync();
var resultx112331tt2 = await _defaultTableDbContext.Set<SysTest>().FirstOrDefaultAsync(o => o.Id == "2"); var resultx112331tt2 = await _defaultTableDbContext.Set<SysTest>().FirstOrDefaultAsync(o => o.Id == "2");
var resultx112331ttaa2 = await _defaultTableDbContext.Set<SysTest>().FirstOrDefaultAsync(o => o.Id == "2"); var resultx112331ttaa2 = await _defaultTableDbContext.Set<SysTest>().FirstOrDefaultAsync(o => o.Id == "2");

View File

@ -28,13 +28,13 @@ namespace Sample.SqlServer
public class Startup public class Startup
{ {
//public static readonly ILoggerFactory efLogger = LoggerFactory.Create(builder => public static readonly ILoggerFactory efLogger = LoggerFactory.Create(builder =>
//{ {
// builder.AddFilter((category, level) => category == DbLoggerCategory.Database.Command.Name && level == LogLevel.Information).AddConsole(); builder.AddFilter((category, level) => category == DbLoggerCategory.Database.Command.Name && level == LogLevel.Information).AddConsole();
//}); });
// This method gets called by the runtime. Use this method to add services to the container. // This method gets called by the runtime. Use this method to add services to the container.
// For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940 // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
public void ConfigureServices(IServiceCollection services) public void ConfigureServices(IServiceCollection services)
{ {
services.AddControllers(); services.AddControllers();
@ -56,8 +56,8 @@ namespace Sample.SqlServer
op.MaxQueryConnectionsLimit = 5; op.MaxQueryConnectionsLimit = 5;
op.UseSqlServer(builder => op.UseSqlServer(builder =>
{ {
var loggerFactory = ShardingContainer.GetService<ILoggerFactory>(); //var loggerFactory = ShardingContainer.GetService<ILoggerFactory>();
builder.UseLoggerFactory(loggerFactory).UseUnionAllMerge<DefaultShardingDbContext>(); builder.UseLoggerFactory(efLogger).UseUnionAllMerge<DefaultShardingDbContext>();
}); });
op.ReplaceTableEnsureManager(sp => new SqlServerTableEnsureManager<DefaultShardingDbContext>()); op.ReplaceTableEnsureManager(sp => new SqlServerTableEnsureManager<DefaultShardingDbContext>());
op.AddDefaultDataSource("A", op.AddDefaultDataSource("A",