mirror of
				https://github.com/nsnail/FreeSql.git
				synced 2025-11-04 01:05:27 +08:00 
			
		
		
		
	- 修复 $"{a.Code}_{a.Id}" lambda 解析当 {} 多于3个时的 bug(.net 内部机制很坑);
> 3个 {} 时,Arguments[1..3] 解析出来是分开的
> 4个 {} 时,Arguments[1] 只能解析这个出来,然后 [1] 里面是 NewArray []
			
			
This commit is contained in:
		@@ -125,13 +125,6 @@
 | 
				
			|||||||
            清空状态数据
 | 
					            清空状态数据
 | 
				
			||||||
            </summary>
 | 
					            </summary>
 | 
				
			||||||
        </member>
 | 
					        </member>
 | 
				
			||||||
        <member name="M:FreeSql.DbSet`1.RemoveAsync(System.Linq.Expressions.Expression{System.Func{`0,System.Boolean}})">
 | 
					 | 
				
			||||||
            <summary>
 | 
					 | 
				
			||||||
            根据 lambda 条件删除数据
 | 
					 | 
				
			||||||
            </summary>
 | 
					 | 
				
			||||||
            <param name="predicate"></param>
 | 
					 | 
				
			||||||
            <returns></returns>
 | 
					 | 
				
			||||||
        </member>
 | 
					 | 
				
			||||||
        <member name="M:FreeSql.DbSet`1.Add(`0)">
 | 
					        <member name="M:FreeSql.DbSet`1.Add(`0)">
 | 
				
			||||||
            <summary>
 | 
					            <summary>
 | 
				
			||||||
            添加
 | 
					            添加
 | 
				
			||||||
@@ -486,14 +479,5 @@
 | 
				
			|||||||
            <param name="that"></param>
 | 
					            <param name="that"></param>
 | 
				
			||||||
            <returns></returns>
 | 
					            <returns></returns>
 | 
				
			||||||
        </member>
 | 
					        </member>
 | 
				
			||||||
        <member name="M:Microsoft.Extensions.DependencyInjection.FreeSqlRepositoryDependencyInjection.AddFreeRepository(Microsoft.Extensions.DependencyInjection.IServiceCollection,System.Action{FreeSql.FluentDataFilter},System.Reflection.Assembly[])">
 | 
					 | 
				
			||||||
            <summary>
 | 
					 | 
				
			||||||
            批量注入 Repository,可以参考代码自行调整
 | 
					 | 
				
			||||||
            </summary>
 | 
					 | 
				
			||||||
            <param name="services"></param>
 | 
					 | 
				
			||||||
            <param name="globalDataFilter"></param>
 | 
					 | 
				
			||||||
            <param name="assemblies"></param>
 | 
					 | 
				
			||||||
            <returns></returns>
 | 
					 | 
				
			||||||
        </member>
 | 
					 | 
				
			||||||
    </members>
 | 
					    </members>
 | 
				
			||||||
</doc>
 | 
					</doc>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -75,6 +75,31 @@ WHERE (a.`Id` = {item.Id})", sql);
 | 
				
			|||||||
            Assert.Equal(string.Format("{0}x{0}z-{1}{2}", item.Id + 1, item.CreateTime.ToString("yyyyMM"), item.Title), item2.str2);
 | 
					            Assert.Equal(string.Format("{0}x{0}z-{1}{2}", item.Id + 1, item.CreateTime.ToString("yyyyMM"), item.Title), item2.str2);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        [Fact]
 | 
				
			||||||
 | 
					        public void Format4()
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            //3<><33> {} ʱ<><CAB1>Arguments <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿֿ<C7B7><D6BF><EFBFBD>
 | 
				
			||||||
 | 
					            //4<><34> {} ʱ<><CAB1>Arguments[1] ֻ<>ܽ<EFBFBD><DCBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȼ<EFBFBD><C8BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> NewArray []
 | 
				
			||||||
 | 
					            var item = g.mysql.GetRepository<Topic>().Insert(new Topic { Clicks = 101, Title = "<22><><EFBFBD><EFBFBD><EFBFBD>й<EFBFBD><D0B9><EFBFBD>101", CreateTime = DateTime.Parse("2020-7-5") });
 | 
				
			||||||
 | 
					            var sql = select.WhereDynamic(item).ToSql(a => new
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                str = $"x{a.Id + 1}z-{a.CreateTime.ToString("yyyyMM")}{a.Title}{a.Title}",
 | 
				
			||||||
 | 
					                str2 = string.Format("{0}x{0}z-{1}{2}{3}", a.Id + 1, a.CreateTime.ToString("yyyyMM"), a.Title, a.Title)
 | 
				
			||||||
 | 
					            });
 | 
				
			||||||
 | 
					            Assert.Equal($@"SELECT concat('x',ifnull((a.`Id` + 1), ''),'z-',ifnull(date_format(a.`CreateTime`,'%Y%m'), ''),'',ifnull(a.`Title`, ''),'',ifnull(a.`Title`, ''),'') as1, concat('',ifnull((a.`Id` + 1), ''),'x',ifnull((a.`Id` + 1), ''),'z-',ifnull(date_format(a.`CreateTime`,'%Y%m'), ''),'',ifnull(a.`Title`, ''),'',ifnull(a.`Title`, ''),'') as2 
 | 
				
			||||||
 | 
					FROM `tb_topic` a 
 | 
				
			||||||
 | 
					WHERE (a.`Id` = {item.Id})", sql);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            var item2 = select.WhereDynamic(item).First(a => new
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                str = $"x{a.Id + 1}z-{a.CreateTime.ToString("yyyyMM")}{a.Title}{a.Title}",
 | 
				
			||||||
 | 
					                str2 = string.Format("{0}x{0}z-{1}{2}{3}", a.Id + 1, a.CreateTime.ToString("yyyyMM"), a.Title, a.Title)
 | 
				
			||||||
 | 
					            });
 | 
				
			||||||
 | 
					            Assert.NotNull(item2);
 | 
				
			||||||
 | 
					            Assert.Equal($"x{item.Id + 1}z-{item.CreateTime.ToString("yyyyMM")}{item.Title}{item.Title}", item2.str);
 | 
				
			||||||
 | 
					            Assert.Equal(string.Format("{0}x{0}z-{1}{2}{3}", item.Id + 1, item.CreateTime.ToString("yyyyMM"), item.Title, item.Title), item2.str2);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        [Fact]
 | 
					        [Fact]
 | 
				
			||||||
        public void Empty()
 | 
					        public void Empty()
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -73,6 +73,31 @@ WHERE (a.""ID"" = {item.Id})", sql);
 | 
				
			|||||||
            Assert.Equal(string.Format("{0}x{0}z-{1}{2}", item.Id + 1, item.CreateTime.ToString("yyyyMM"), item.Title), item2.str2);
 | 
					            Assert.Equal(string.Format("{0}x{0}z-{1}{2}", item.Id + 1, item.CreateTime.ToString("yyyyMM"), item.Title), item2.str2);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        [Fact]
 | 
				
			||||||
 | 
					        public void Format4()
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            //3<><33> {} ʱ<><CAB1>Arguments <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿֿ<C7B7><D6BF><EFBFBD>
 | 
				
			||||||
 | 
					            //4<><34> {} ʱ<><CAB1>Arguments[1] ֻ<>ܽ<EFBFBD><DCBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȼ<EFBFBD><C8BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> NewArray []
 | 
				
			||||||
 | 
					            var item = g.dameng.GetRepository<Topic>().Insert(new Topic { Clicks = 101, Title = "<22><><EFBFBD><EFBFBD><EFBFBD>й<EFBFBD><D0B9><EFBFBD>101", CreateTime = DateTime.Parse("2020-7-5") });
 | 
				
			||||||
 | 
					            var sql = select.WhereDynamic(item).ToSql(a => new
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                str = $"x{a.Id + 1}z-{a.CreateTime.ToString("yyyyMM")}{a.Title}{a.Title}",
 | 
				
			||||||
 | 
					                str2 = string.Format("{0}x{0}z-{1}{2}{3}", a.Id + 1, a.CreateTime.ToString("yyyyMM"), a.Title, a.Title)
 | 
				
			||||||
 | 
					            });
 | 
				
			||||||
 | 
					            Assert.Equal($@"SELECT 'x'||nvl((a.""ID"" + 1), '')||'z-'||nvl(to_char(a.""CREATETIME"",'YYYYMM'), '')||''||nvl(a.""TITLE"", '')||''||nvl(a.""TITLE"", '')||'' as1, ''||nvl((a.""ID"" + 1), '')||'x'||nvl((a.""ID"" + 1), '')||'z-'||nvl(to_char(a.""CREATETIME"",'YYYYMM'), '')||''||nvl(a.""TITLE"", '')||''||nvl(a.""TITLE"", '')||'' as2 
 | 
				
			||||||
 | 
					FROM ""TB_TOPIC"" a 
 | 
				
			||||||
 | 
					WHERE (a.""ID"" = {item.Id})", sql);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            var item2 = select.WhereDynamic(item).First(a => new
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                str = $"x{a.Id + 1}z-{a.CreateTime.ToString("yyyyMM")}{a.Title}{a.Title}",
 | 
				
			||||||
 | 
					                str2 = string.Format("{0}x{0}z-{1}{2}{3}", a.Id + 1, a.CreateTime.ToString("yyyyMM"), a.Title, a.Title)
 | 
				
			||||||
 | 
					            });
 | 
				
			||||||
 | 
					            Assert.NotNull(item2);
 | 
				
			||||||
 | 
					            Assert.Equal($"x{item.Id + 1}z-{item.CreateTime.ToString("yyyyMM")}{item.Title}{item.Title}", item2.str);
 | 
				
			||||||
 | 
					            Assert.Equal(string.Format("{0}x{0}z-{1}{2}{3}", item.Id + 1, item.CreateTime.ToString("yyyyMM"), item.Title, item.Title), item2.str2);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        [Fact]
 | 
					        [Fact]
 | 
				
			||||||
        public void Empty()
 | 
					        public void Empty()
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -73,6 +73,31 @@ WHERE (a.""ID"" = {item.Id})", sql);
 | 
				
			|||||||
            Assert.Equal(string.Format("{0}x{0}z-{1}{2}", item.Id + 1, item.CreateTime.ToString("yyyyMM"), item.Title), item2.str2);
 | 
					            Assert.Equal(string.Format("{0}x{0}z-{1}{2}", item.Id + 1, item.CreateTime.ToString("yyyyMM"), item.Title), item2.str2);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        [Fact]
 | 
				
			||||||
 | 
					        public void Format4()
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            //3<><33> {} ʱ<><CAB1>Arguments <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿֿ<C7B7><D6BF><EFBFBD>
 | 
				
			||||||
 | 
					            //4<><34> {} ʱ<><CAB1>Arguments[1] ֻ<>ܽ<EFBFBD><DCBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȼ<EFBFBD><C8BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> NewArray []
 | 
				
			||||||
 | 
					            var item = g.kingbaseES.GetRepository<Topic>().Insert(new Topic { Clicks = 101, Title = "<22><><EFBFBD><EFBFBD><EFBFBD>й<EFBFBD><D0B9><EFBFBD>101", CreateTime = DateTime.Parse("2020-7-5") });
 | 
				
			||||||
 | 
					            var sql = select.WhereDynamic(item).ToSql(a => new
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                str = $"x{a.Id + 1}z-{a.CreateTime.ToString("yyyyMM")}{a.Title}{a.Title}",
 | 
				
			||||||
 | 
					                str2 = string.Format("{0}x{0}z-{1}{2}{3}", a.Id + 1, a.CreateTime.ToString("yyyyMM"), a.Title, a.Title)
 | 
				
			||||||
 | 
					            });
 | 
				
			||||||
 | 
					            Assert.Equal($@"SELECT 'x'||coalesce(((a.""ID"" + 1))::text, '')||'z-'||coalesce(to_char((a.""CREATETIME"")::timestamp,'YYYYMM'), '')||''||coalesce(a.""TITLE"", '')||''||coalesce(a.""TITLE"", '')||'' as1, ''||coalesce(((a.""ID"" + 1))::text, '')||'x'||coalesce(((a.""ID"" + 1))::text, '')||'z-'||coalesce(to_char((a.""CREATETIME"")::timestamp,'YYYYMM'), '')||''||coalesce(a.""TITLE"", '')||''||coalesce(a.""TITLE"", '')||'' as2 
 | 
				
			||||||
 | 
					FROM ""TB_TOPIC"" a 
 | 
				
			||||||
 | 
					WHERE (a.""ID"" = {item.Id})", sql);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            var item2 = select.WhereDynamic(item).First(a => new
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                str = $"x{a.Id + 1}z-{a.CreateTime.ToString("yyyyMM")}{a.Title}{a.Title}",
 | 
				
			||||||
 | 
					                str2 = string.Format("{0}x{0}z-{1}{2}{3}", a.Id + 1, a.CreateTime.ToString("yyyyMM"), a.Title, a.Title)
 | 
				
			||||||
 | 
					            });
 | 
				
			||||||
 | 
					            Assert.NotNull(item2);
 | 
				
			||||||
 | 
					            Assert.Equal($"x{item.Id + 1}z-{item.CreateTime.ToString("yyyyMM")}{item.Title}{item.Title}", item2.str);
 | 
				
			||||||
 | 
					            Assert.Equal(string.Format("{0}x{0}z-{1}{2}{3}", item.Id + 1, item.CreateTime.ToString("yyyyMM"), item.Title, item.Title), item2.str2);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        [Fact]
 | 
					        [Fact]
 | 
				
			||||||
        public void Empty()
 | 
					        public void Empty()
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -75,6 +75,31 @@ WHERE (a.`Id` = {item.Id})", sql);
 | 
				
			|||||||
            Assert.Equal(string.Format("{0}x{0}z-{1}{2}", item.Id + 1, item.CreateTime.ToString("yyyyMM"), item.Title), item2.str2);
 | 
					            Assert.Equal(string.Format("{0}x{0}z-{1}{2}", item.Id + 1, item.CreateTime.ToString("yyyyMM"), item.Title), item2.str2);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        [Fact]
 | 
				
			||||||
 | 
					        public void Format4()
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            //3<><33> {} ʱ<><CAB1>Arguments <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿֿ<C7B7><D6BF><EFBFBD>
 | 
				
			||||||
 | 
					            //4<><34> {} ʱ<><CAB1>Arguments[1] ֻ<>ܽ<EFBFBD><DCBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȼ<EFBFBD><C8BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> NewArray []
 | 
				
			||||||
 | 
					            var item = g.mysql.GetRepository<Topic>().Insert(new Topic { Clicks = 101, Title = "<22><><EFBFBD><EFBFBD><EFBFBD>й<EFBFBD><D0B9><EFBFBD>101", CreateTime = DateTime.Parse("2020-7-5") });
 | 
				
			||||||
 | 
					            var sql = select.WhereDynamic(item).ToSql(a => new
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                str = $"x{a.Id + 1}z-{a.CreateTime.ToString("yyyyMM")}{a.Title}{a.Title}",
 | 
				
			||||||
 | 
					                str2 = string.Format("{0}x{0}z-{1}{2}{3}", a.Id + 1, a.CreateTime.ToString("yyyyMM"), a.Title, a.Title)
 | 
				
			||||||
 | 
					            });
 | 
				
			||||||
 | 
					            Assert.Equal($@"SELECT concat('x',ifnull((a.`Id` + 1), ''),'z-',ifnull(date_format(a.`CreateTime`,'%Y%m'), ''),'',ifnull(a.`Title`, ''),'',ifnull(a.`Title`, ''),'') as1, concat('',ifnull((a.`Id` + 1), ''),'x',ifnull((a.`Id` + 1), ''),'z-',ifnull(date_format(a.`CreateTime`,'%Y%m'), ''),'',ifnull(a.`Title`, ''),'',ifnull(a.`Title`, ''),'') as2 
 | 
				
			||||||
 | 
					FROM `tb_topic` a 
 | 
				
			||||||
 | 
					WHERE (a.`Id` = {item.Id})", sql);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            var item2 = select.WhereDynamic(item).First(a => new
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                str = $"x{a.Id + 1}z-{a.CreateTime.ToString("yyyyMM")}{a.Title}{a.Title}",
 | 
				
			||||||
 | 
					                str2 = string.Format("{0}x{0}z-{1}{2}{3}", a.Id + 1, a.CreateTime.ToString("yyyyMM"), a.Title, a.Title)
 | 
				
			||||||
 | 
					            });
 | 
				
			||||||
 | 
					            Assert.NotNull(item2);
 | 
				
			||||||
 | 
					            Assert.Equal($"x{item.Id + 1}z-{item.CreateTime.ToString("yyyyMM")}{item.Title}{item.Title}", item2.str);
 | 
				
			||||||
 | 
					            Assert.Equal(string.Format("{0}x{0}z-{1}{2}{3}", item.Id + 1, item.CreateTime.ToString("yyyyMM"), item.Title, item.Title), item2.str2);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        [Fact]
 | 
					        [Fact]
 | 
				
			||||||
        public void Empty()
 | 
					        public void Empty()
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -73,6 +73,31 @@ WHERE (a.""ID"" = {item.Id})", sql);
 | 
				
			|||||||
            Assert.Equal(string.Format("{0}x{0}z-{1}{2}", item.Id + 1, item.CreateTime.ToString("yyyyMM"), item.Title), item2.str2);
 | 
					            Assert.Equal(string.Format("{0}x{0}z-{1}{2}", item.Id + 1, item.CreateTime.ToString("yyyyMM"), item.Title), item2.str2);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        [Fact]
 | 
				
			||||||
 | 
					        public void Format4()
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            //3<><33> {} ʱ<><CAB1>Arguments <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿֿ<C7B7><D6BF><EFBFBD>
 | 
				
			||||||
 | 
					            //4<><34> {} ʱ<><CAB1>Arguments[1] ֻ<>ܽ<EFBFBD><DCBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȼ<EFBFBD><C8BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> NewArray []
 | 
				
			||||||
 | 
					            var item = g.oracle.GetRepository<Topic>().Insert(new Topic { Clicks = 101, Title = "<22><><EFBFBD><EFBFBD><EFBFBD>й<EFBFBD><D0B9><EFBFBD>101", CreateTime = DateTime.Parse("2020-7-5") });
 | 
				
			||||||
 | 
					            var sql = select.WhereDynamic(item).ToSql(a => new
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                str = $"x{a.Id + 1}z-{a.CreateTime.ToString("yyyyMM")}{a.Title}{a.Title}",
 | 
				
			||||||
 | 
					                str2 = string.Format("{0}x{0}z-{1}{2}{3}", a.Id + 1, a.CreateTime.ToString("yyyyMM"), a.Title, a.Title)
 | 
				
			||||||
 | 
					            });
 | 
				
			||||||
 | 
					            Assert.Equal($@"SELECT 'x'||nvl((a.""ID"" + 1), '')||'z-'||nvl(to_char(a.""CREATETIME"",'YYYYMM'), '')||''||nvl(a.""TITLE"", '')||''||nvl(a.""TITLE"", '')||'' as1, ''||nvl((a.""ID"" + 1), '')||'x'||nvl((a.""ID"" + 1), '')||'z-'||nvl(to_char(a.""CREATETIME"",'YYYYMM'), '')||''||nvl(a.""TITLE"", '')||''||nvl(a.""TITLE"", '')||'' as2 
 | 
				
			||||||
 | 
					FROM ""TB_TOPIC"" a 
 | 
				
			||||||
 | 
					WHERE (a.""ID"" = {item.Id})", sql);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            var item2 = select.WhereDynamic(item).First(a => new
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                str = $"x{a.Id + 1}z-{a.CreateTime.ToString("yyyyMM")}{a.Title}{a.Title}",
 | 
				
			||||||
 | 
					                str2 = string.Format("{0}x{0}z-{1}{2}{3}", a.Id + 1, a.CreateTime.ToString("yyyyMM"), a.Title, a.Title)
 | 
				
			||||||
 | 
					            });
 | 
				
			||||||
 | 
					            Assert.NotNull(item2);
 | 
				
			||||||
 | 
					            Assert.Equal($"x{item.Id + 1}z-{item.CreateTime.ToString("yyyyMM")}{item.Title}{item.Title}", item2.str);
 | 
				
			||||||
 | 
					            Assert.Equal(string.Format("{0}x{0}z-{1}{2}{3}", item.Id + 1, item.CreateTime.ToString("yyyyMM"), item.Title, item.Title), item2.str2);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        [Fact]
 | 
					        [Fact]
 | 
				
			||||||
        public void Empty()
 | 
					        public void Empty()
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -73,6 +73,31 @@ WHERE (a.""id"" = {item.Id})", sql);
 | 
				
			|||||||
            Assert.Equal(string.Format("{0}x{0}z-{1}{2}", item.Id + 1, item.CreateTime.ToString("yyyyMM"), item.Title), item2.str2);
 | 
					            Assert.Equal(string.Format("{0}x{0}z-{1}{2}", item.Id + 1, item.CreateTime.ToString("yyyyMM"), item.Title), item2.str2);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        [Fact]
 | 
				
			||||||
 | 
					        public void Format4()
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            //3<><33> {} ʱ<><CAB1>Arguments <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿֿ<C7B7><D6BF><EFBFBD>
 | 
				
			||||||
 | 
					            //4<><34> {} ʱ<><CAB1>Arguments[1] ֻ<>ܽ<EFBFBD><DCBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȼ<EFBFBD><C8BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> NewArray []
 | 
				
			||||||
 | 
					            var item = g.pgsql.GetRepository<Topic>().Insert(new Topic { Clicks = 101, Title = "<22><><EFBFBD><EFBFBD><EFBFBD>й<EFBFBD><D0B9><EFBFBD>101", CreateTime = DateTime.Parse("2020-7-5") });
 | 
				
			||||||
 | 
					            var sql = select.WhereDynamic(item).ToSql(a => new
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                str = $"x{a.Id + 1}z-{a.CreateTime.ToString("yyyyMM")}{a.Title}{a.Title}",
 | 
				
			||||||
 | 
					                str2 = string.Format("{0}x{0}z-{1}{2}{3}", a.Id + 1, a.CreateTime.ToString("yyyyMM"), a.Title, a.Title)
 | 
				
			||||||
 | 
					            });
 | 
				
			||||||
 | 
					            Assert.Equal($@"SELECT 'x'||coalesce(((a.""id"" + 1))::text, '')||'z-'||coalesce(to_char((a.""createtime"")::timestamp,'YYYYMM'), '')||''||coalesce(a.""title"", '')||''||coalesce(a.""title"", '')||'' as1, ''||coalesce(((a.""id"" + 1))::text, '')||'x'||coalesce(((a.""id"" + 1))::text, '')||'z-'||coalesce(to_char((a.""createtime"")::timestamp,'YYYYMM'), '')||''||coalesce(a.""title"", '')||''||coalesce(a.""title"", '')||'' as2 
 | 
				
			||||||
 | 
					FROM ""tb_topic"" a 
 | 
				
			||||||
 | 
					WHERE (a.""id"" = {item.Id})", sql);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            var item2 = select.WhereDynamic(item).First(a => new
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                str = $"x{a.Id + 1}z-{a.CreateTime.ToString("yyyyMM")}{a.Title}{a.Title}",
 | 
				
			||||||
 | 
					                str2 = string.Format("{0}x{0}z-{1}{2}{3}", a.Id + 1, a.CreateTime.ToString("yyyyMM"), a.Title, a.Title)
 | 
				
			||||||
 | 
					            });
 | 
				
			||||||
 | 
					            Assert.NotNull(item2);
 | 
				
			||||||
 | 
					            Assert.Equal($"x{item.Id + 1}z-{item.CreateTime.ToString("yyyyMM")}{item.Title}{item.Title}", item2.str);
 | 
				
			||||||
 | 
					            Assert.Equal(string.Format("{0}x{0}z-{1}{2}{3}", item.Id + 1, item.CreateTime.ToString("yyyyMM"), item.Title, item.Title), item2.str2);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        [Fact]
 | 
					        [Fact]
 | 
				
			||||||
        public void Empty()
 | 
					        public void Empty()
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -74,6 +74,31 @@ WHERE (a.[Id] = {item.Id})", sql);
 | 
				
			|||||||
            Assert.Equal(string.Format("{0}x{0}z-{1}{2}", item.Id + 1, item.CreateTime.ToString("yyyyMM"), item.Title), item2.str2);
 | 
					            Assert.Equal(string.Format("{0}x{0}z-{1}{2}", item.Id + 1, item.CreateTime.ToString("yyyyMM"), item.Title), item2.str2);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        [Fact]
 | 
				
			||||||
 | 
					        public void Format4()
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            //3<><33> {} ʱ<><CAB1>Arguments <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿֿ<C7B7><D6BF><EFBFBD>
 | 
				
			||||||
 | 
					            //4<><34> {} ʱ<><CAB1>Arguments[1] ֻ<>ܽ<EFBFBD><DCBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȼ<EFBFBD><C8BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> NewArray []
 | 
				
			||||||
 | 
					            var item = g.sqlserver.GetRepository<Topic>().Insert(new Topic { Clicks = 101, Title = "<22><><EFBFBD><EFBFBD><EFBFBD>й<EFBFBD><D0B9><EFBFBD>101", CreateTime = DateTime.Parse("2020-7-5") });
 | 
				
			||||||
 | 
					            var sql = select.WhereDynamic(item).ToSql(a => new
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                str = $"x{a.Id + 1}z-{a.CreateTime.ToString("yyyyMM")}{a.Title}{a.Title}",
 | 
				
			||||||
 | 
					                str2 = string.Format("{0}x{0}z-{1}{2}{3}", a.Id + 1, a.CreateTime.ToString("yyyyMM"), a.Title, a.Title)
 | 
				
			||||||
 | 
					            });
 | 
				
			||||||
 | 
					            Assert.Equal($@"SELECT N'x'+isnull(cast((a.[Id] + 1) as varchar), '')+N'z-'+isnull(substring(convert(char(8), cast(a.[CreateTime] as datetime), 112), 1, 6), '')+N''+isnull(a.[Title], '')+N''+isnull(a.[Title], '')+N'' as1, N''+isnull(cast((a.[Id] + 1) as varchar), '')+N'x'+isnull(cast((a.[Id] + 1) as varchar), '')+N'z-'+isnull(substring(convert(char(8), cast(a.[CreateTime] as datetime), 112), 1, 6), '')+N''+isnull(a.[Title], '')+N''+isnull(a.[Title], '')+N'' as2 
 | 
				
			||||||
 | 
					FROM [tb_topic] a 
 | 
				
			||||||
 | 
					WHERE (a.[Id] = {item.Id})", sql);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            var item2 = select.WhereDynamic(item).First(a => new
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                str = $"x{a.Id + 1}z-{a.CreateTime.ToString("yyyyMM")}{a.Title}{a.Title}",
 | 
				
			||||||
 | 
					                str2 = string.Format("{0}x{0}z-{1}{2}{3}", a.Id + 1, a.CreateTime.ToString("yyyyMM"), a.Title, a.Title)
 | 
				
			||||||
 | 
					            });
 | 
				
			||||||
 | 
					            Assert.NotNull(item2);
 | 
				
			||||||
 | 
					            Assert.Equal($"x{item.Id + 1}z-{item.CreateTime.ToString("yyyyMM")}{item.Title}{item.Title}", item2.str);
 | 
				
			||||||
 | 
					            Assert.Equal(string.Format("{0}x{0}z-{1}{2}{3}", item.Id + 1, item.CreateTime.ToString("yyyyMM"), item.Title, item.Title), item2.str2);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        [Fact]
 | 
					        [Fact]
 | 
				
			||||||
        public void Empty()
 | 
					        public void Empty()
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -73,6 +73,31 @@ WHERE (a.""ID"" = {item.Id})", sql);
 | 
				
			|||||||
            Assert.Equal(string.Format("{0}x{0}z-{1}{2}", item.Id + 1, item.CreateTime.ToString("yyyyMM"), item.Title), item2.str2);
 | 
					            Assert.Equal(string.Format("{0}x{0}z-{1}{2}", item.Id + 1, item.CreateTime.ToString("yyyyMM"), item.Title), item2.str2);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        [Fact]
 | 
				
			||||||
 | 
					        public void Format4()
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            //3<><33> {} ʱ<><CAB1>Arguments <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿֿ<C7B7><D6BF><EFBFBD>
 | 
				
			||||||
 | 
					            //4<><34> {} ʱ<><CAB1>Arguments[1] ֻ<>ܽ<EFBFBD><DCBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȼ<EFBFBD><C8BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> NewArray []
 | 
				
			||||||
 | 
					            var item = g.dameng.GetRepository<Topic>().Insert(new Topic { Clicks = 101, Title = "<22><><EFBFBD><EFBFBD><EFBFBD>й<EFBFBD><D0B9><EFBFBD>101", CreateTime = DateTime.Parse("2020-7-5") });
 | 
				
			||||||
 | 
					            var sql = select.WhereDynamic(item).ToSql(a => new
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                str = $"x{a.Id + 1}z-{a.CreateTime.ToString("yyyyMM")}{a.Title}{a.Title}",
 | 
				
			||||||
 | 
					                str2 = string.Format("{0}x{0}z-{1}{2}{3}", a.Id + 1, a.CreateTime.ToString("yyyyMM"), a.Title, a.Title)
 | 
				
			||||||
 | 
					            });
 | 
				
			||||||
 | 
					            Assert.Equal($@"SELECT 'x'||nvl((a.""ID"" + 1), '')||'z-'||nvl(to_char(a.""CREATETIME"",'YYYYMM'), '')||''||nvl(a.""TITLE"", '')||''||nvl(a.""TITLE"", '')||'' as1, ''||nvl((a.""ID"" + 1), '')||'x'||nvl((a.""ID"" + 1), '')||'z-'||nvl(to_char(a.""CREATETIME"",'YYYYMM'), '')||''||nvl(a.""TITLE"", '')||''||nvl(a.""TITLE"", '')||'' as2 
 | 
				
			||||||
 | 
					FROM ""TB_TOPIC"" a 
 | 
				
			||||||
 | 
					WHERE (a.""ID"" = {item.Id})", sql);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            var item2 = select.WhereDynamic(item).First(a => new
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                str = $"x{a.Id + 1}z-{a.CreateTime.ToString("yyyyMM")}{a.Title}{a.Title}",
 | 
				
			||||||
 | 
					                str2 = string.Format("{0}x{0}z-{1}{2}{3}", a.Id + 1, a.CreateTime.ToString("yyyyMM"), a.Title, a.Title)
 | 
				
			||||||
 | 
					            });
 | 
				
			||||||
 | 
					            Assert.NotNull(item2);
 | 
				
			||||||
 | 
					            Assert.Equal($"x{item.Id + 1}z-{item.CreateTime.ToString("yyyyMM")}{item.Title}{item.Title}", item2.str);
 | 
				
			||||||
 | 
					            Assert.Equal(string.Format("{0}x{0}z-{1}{2}{3}", item.Id + 1, item.CreateTime.ToString("yyyyMM"), item.Title, item.Title), item2.str2);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        [Fact]
 | 
					        [Fact]
 | 
				
			||||||
        public void Empty()
 | 
					        public void Empty()
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -73,6 +73,31 @@ WHERE (a.[Id] = {item.Id})", sql);
 | 
				
			|||||||
            Assert.Equal(string.Format("{0}x{0}z-{1}{2}", item.Id + 1, item.CreateTime.ToString("yyyyMM"), item.Title), item2.str2);
 | 
					            Assert.Equal(string.Format("{0}x{0}z-{1}{2}", item.Id + 1, item.CreateTime.ToString("yyyyMM"), item.Title), item2.str2);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        [Fact]
 | 
				
			||||||
 | 
					        public void Format4()
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            //3<><33> {} ʱ<><CAB1>Arguments <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿֿ<C7B7><D6BF><EFBFBD>
 | 
				
			||||||
 | 
					            //4<><34> {} ʱ<><CAB1>Arguments[1] ֻ<>ܽ<EFBFBD><DCBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȼ<EFBFBD><C8BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> NewArray []
 | 
				
			||||||
 | 
					            var item = g.msaccess.GetRepository<Topic>().Insert(new Topic { Clicks = 101, Title = "<22><><EFBFBD><EFBFBD><EFBFBD>й<EFBFBD><D0B9><EFBFBD>101", CreateTime = DateTime.Parse("2020-7-5") });
 | 
				
			||||||
 | 
					            var sql = select.WhereDynamic(item).ToSql(a => new
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                str = $"x{a.Id + 1}z-{a.CreateTime.ToString("yyyyMM")}{a.Title}{a.Title}",
 | 
				
			||||||
 | 
					                str2 = string.Format("{0}x{0}z-{1}{2}{3}", a.Id + 1, a.CreateTime.ToString("yyyyMM"), a.Title, a.Title)
 | 
				
			||||||
 | 
					            });
 | 
				
			||||||
 | 
					            Assert.Equal($@"SELECT 'x'+iif(isnull(cstr((a.[Id] + 1))), '', cstr((a.[Id] + 1)))+'z-'+iif(isnull(format(a.[CreateTime],'yyyyMM')), '', format(a.[CreateTime],'yyyyMM'))+''+iif(isnull(a.[Title]), '', a.[Title])+''+iif(isnull(a.[Title]), '', a.[Title])+'' as as1, ''+iif(isnull(cstr((a.[Id] + 1))), '', cstr((a.[Id] + 1)))+'x'+iif(isnull(cstr((a.[Id] + 1))), '', cstr((a.[Id] + 1)))+'z-'+iif(isnull(format(a.[CreateTime],'yyyyMM')), '', format(a.[CreateTime],'yyyyMM'))+''+iif(isnull(a.[Title]), '', a.[Title])+''+iif(isnull(a.[Title]), '', a.[Title])+'' as as2 
 | 
				
			||||||
 | 
					FROM [tb_topic] a 
 | 
				
			||||||
 | 
					WHERE (a.[Id] = {item.Id})", sql);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            var item2 = select.WhereDynamic(item).First(a => new
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                str = $"x{a.Id + 1}z-{a.CreateTime.ToString("yyyyMM")}{a.Title}{a.Title}",
 | 
				
			||||||
 | 
					                str2 = string.Format("{0}x{0}z-{1}{2}{3}", a.Id + 1, a.CreateTime.ToString("yyyyMM"), a.Title, a.Title)
 | 
				
			||||||
 | 
					            });
 | 
				
			||||||
 | 
					            Assert.NotNull(item2);
 | 
				
			||||||
 | 
					            Assert.Equal($"x{item.Id + 1}z-{item.CreateTime.ToString("yyyyMM")}{item.Title}{item.Title}", item2.str);
 | 
				
			||||||
 | 
					            Assert.Equal(string.Format("{0}x{0}z-{1}{2}{3}", item.Id + 1, item.CreateTime.ToString("yyyyMM"), item.Title, item.Title), item2.str2);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        [Fact]
 | 
					        [Fact]
 | 
				
			||||||
        public void Empty()
 | 
					        public void Empty()
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -75,6 +75,31 @@ WHERE (a.`Id` = {item.Id})", sql);
 | 
				
			|||||||
            Assert.Equal(string.Format("{0}x{0}z-{1}{2}", item.Id + 1, item.CreateTime.ToString("yyyyMM"), item.Title), item2.str2);
 | 
					            Assert.Equal(string.Format("{0}x{0}z-{1}{2}", item.Id + 1, item.CreateTime.ToString("yyyyMM"), item.Title), item2.str2);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        [Fact]
 | 
				
			||||||
 | 
					        public void Format4()
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            //3<><33> {} ʱ<><CAB1>Arguments <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿֿ<C7B7><D6BF><EFBFBD>
 | 
				
			||||||
 | 
					            //4<><34> {} ʱ<><CAB1>Arguments[1] ֻ<>ܽ<EFBFBD><DCBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȼ<EFBFBD><C8BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> NewArray []
 | 
				
			||||||
 | 
					            var item = g.mysql.GetRepository<Topic>().Insert(new Topic { Clicks = 101, Title = "<22><><EFBFBD><EFBFBD><EFBFBD>й<EFBFBD><D0B9><EFBFBD>101", CreateTime = DateTime.Parse("2020-7-5") });
 | 
				
			||||||
 | 
					            var sql = select.WhereDynamic(item).ToSql(a => new
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                str = $"x{a.Id + 1}z-{a.CreateTime.ToString("yyyyMM")}{a.Title}{a.Title}",
 | 
				
			||||||
 | 
					                str2 = string.Format("{0}x{0}z-{1}{2}{3}", a.Id + 1, a.CreateTime.ToString("yyyyMM"), a.Title, a.Title)
 | 
				
			||||||
 | 
					            });
 | 
				
			||||||
 | 
					            Assert.Equal($@"SELECT concat('x',ifnull((a.`Id` + 1), ''),'z-',ifnull(date_format(a.`CreateTime`,'%Y%m'), ''),'',ifnull(a.`Title`, ''),'',ifnull(a.`Title`, ''),'') as1, concat('',ifnull((a.`Id` + 1), ''),'x',ifnull((a.`Id` + 1), ''),'z-',ifnull(date_format(a.`CreateTime`,'%Y%m'), ''),'',ifnull(a.`Title`, ''),'',ifnull(a.`Title`, ''),'') as2 
 | 
				
			||||||
 | 
					FROM `tb_topic` a 
 | 
				
			||||||
 | 
					WHERE (a.`Id` = {item.Id})", sql);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            var item2 = select.WhereDynamic(item).First(a => new
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                str = $"x{a.Id + 1}z-{a.CreateTime.ToString("yyyyMM")}{a.Title}{a.Title}",
 | 
				
			||||||
 | 
					                str2 = string.Format("{0}x{0}z-{1}{2}{3}", a.Id + 1, a.CreateTime.ToString("yyyyMM"), a.Title, a.Title)
 | 
				
			||||||
 | 
					            });
 | 
				
			||||||
 | 
					            Assert.NotNull(item2);
 | 
				
			||||||
 | 
					            Assert.Equal($"x{item.Id + 1}z-{item.CreateTime.ToString("yyyyMM")}{item.Title}{item.Title}", item2.str);
 | 
				
			||||||
 | 
					            Assert.Equal(string.Format("{0}x{0}z-{1}{2}{3}", item.Id + 1, item.CreateTime.ToString("yyyyMM"), item.Title, item.Title), item2.str2);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        [Fact]
 | 
					        [Fact]
 | 
				
			||||||
        public void Empty()
 | 
					        public void Empty()
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -73,6 +73,31 @@ WHERE (a.""ID"" = {item.Id})", sql);
 | 
				
			|||||||
            Assert.Equal(string.Format("{0}x{0}z-{1}{2}", item.Id + 1, item.CreateTime.ToString("yyyyMM"), item.Title), item2.str2);
 | 
					            Assert.Equal(string.Format("{0}x{0}z-{1}{2}", item.Id + 1, item.CreateTime.ToString("yyyyMM"), item.Title), item2.str2);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        [Fact]
 | 
				
			||||||
 | 
					        public void Format4()
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            //3<><33> {} ʱ<><CAB1>Arguments <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿֿ<C7B7><D6BF><EFBFBD>
 | 
				
			||||||
 | 
					            //4<><34> {} ʱ<><CAB1>Arguments[1] ֻ<>ܽ<EFBFBD><DCBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȼ<EFBFBD><C8BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> NewArray []
 | 
				
			||||||
 | 
					            var item = g.oracle.GetRepository<Topic>().Insert(new Topic { Clicks = 101, Title = "<22><><EFBFBD><EFBFBD><EFBFBD>й<EFBFBD><D0B9><EFBFBD>101", CreateTime = DateTime.Parse("2020-7-5") });
 | 
				
			||||||
 | 
					            var sql = select.WhereDynamic(item).ToSql(a => new
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                str = $"x{a.Id + 1}z-{a.CreateTime.ToString("yyyyMM")}{a.Title}{a.Title}",
 | 
				
			||||||
 | 
					                str2 = string.Format("{0}x{0}z-{1}{2}{3}", a.Id + 1, a.CreateTime.ToString("yyyyMM"), a.Title, a.Title)
 | 
				
			||||||
 | 
					            });
 | 
				
			||||||
 | 
					            Assert.Equal($@"SELECT 'x'||nvl((a.""ID"" + 1), '')||'z-'||nvl(to_char(a.""CREATETIME"",'YYYYMM'), '')||''||nvl(a.""TITLE"", '')||''||nvl(a.""TITLE"", '')||'' as1, ''||nvl((a.""ID"" + 1), '')||'x'||nvl((a.""ID"" + 1), '')||'z-'||nvl(to_char(a.""CREATETIME"",'YYYYMM'), '')||''||nvl(a.""TITLE"", '')||''||nvl(a.""TITLE"", '')||'' as2 
 | 
				
			||||||
 | 
					FROM ""TB_TOPIC"" a 
 | 
				
			||||||
 | 
					WHERE (a.""ID"" = {item.Id})", sql);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            var item2 = select.WhereDynamic(item).First(a => new
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                str = $"x{a.Id + 1}z-{a.CreateTime.ToString("yyyyMM")}{a.Title}{a.Title}",
 | 
				
			||||||
 | 
					                str2 = string.Format("{0}x{0}z-{1}{2}{3}", a.Id + 1, a.CreateTime.ToString("yyyyMM"), a.Title, a.Title)
 | 
				
			||||||
 | 
					            });
 | 
				
			||||||
 | 
					            Assert.NotNull(item2);
 | 
				
			||||||
 | 
					            Assert.Equal($"x{item.Id + 1}z-{item.CreateTime.ToString("yyyyMM")}{item.Title}{item.Title}", item2.str);
 | 
				
			||||||
 | 
					            Assert.Equal(string.Format("{0}x{0}z-{1}{2}{3}", item.Id + 1, item.CreateTime.ToString("yyyyMM"), item.Title, item.Title), item2.str2);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        [Fact]
 | 
					        [Fact]
 | 
				
			||||||
        public void Empty()
 | 
					        public void Empty()
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -73,6 +73,31 @@ WHERE (a.""id"" = {item.Id})", sql);
 | 
				
			|||||||
            Assert.Equal(string.Format("{0}x{0}z-{1}{2}", item.Id + 1, item.CreateTime.ToString("yyyyMM"), item.Title), item2.str2);
 | 
					            Assert.Equal(string.Format("{0}x{0}z-{1}{2}", item.Id + 1, item.CreateTime.ToString("yyyyMM"), item.Title), item2.str2);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        [Fact]
 | 
				
			||||||
 | 
					        public void Format4()
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            //3<><33> {} ʱ<><CAB1>Arguments <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿֿ<C7B7><D6BF><EFBFBD>
 | 
				
			||||||
 | 
					            //4<><34> {} ʱ<><CAB1>Arguments[1] ֻ<>ܽ<EFBFBD><DCBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȼ<EFBFBD><C8BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> NewArray []
 | 
				
			||||||
 | 
					            var item = g.pgsql.GetRepository<Topic>().Insert(new Topic { Clicks = 101, Title = "<22><><EFBFBD><EFBFBD><EFBFBD>й<EFBFBD><D0B9><EFBFBD>101", CreateTime = DateTime.Parse("2020-7-5") });
 | 
				
			||||||
 | 
					            var sql = select.WhereDynamic(item).ToSql(a => new
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                str = $"x{a.Id + 1}z-{a.CreateTime.ToString("yyyyMM")}{a.Title}{a.Title}",
 | 
				
			||||||
 | 
					                str2 = string.Format("{0}x{0}z-{1}{2}{3}", a.Id + 1, a.CreateTime.ToString("yyyyMM"), a.Title, a.Title)
 | 
				
			||||||
 | 
					            });
 | 
				
			||||||
 | 
					            Assert.Equal($@"SELECT 'x'||coalesce(((a.""id"" + 1))::text, '')||'z-'||coalesce(to_char((a.""createtime"")::timestamp,'YYYYMM'), '')||''||coalesce(a.""title"", '')||''||coalesce(a.""title"", '')||'' as1, ''||coalesce(((a.""id"" + 1))::text, '')||'x'||coalesce(((a.""id"" + 1))::text, '')||'z-'||coalesce(to_char((a.""createtime"")::timestamp,'YYYYMM'), '')||''||coalesce(a.""title"", '')||''||coalesce(a.""title"", '')||'' as2 
 | 
				
			||||||
 | 
					FROM ""tb_topic"" a 
 | 
				
			||||||
 | 
					WHERE (a.""id"" = {item.Id})", sql);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            var item2 = select.WhereDynamic(item).First(a => new
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                str = $"x{a.Id + 1}z-{a.CreateTime.ToString("yyyyMM")}{a.Title}{a.Title}",
 | 
				
			||||||
 | 
					                str2 = string.Format("{0}x{0}z-{1}{2}{3}", a.Id + 1, a.CreateTime.ToString("yyyyMM"), a.Title, a.Title)
 | 
				
			||||||
 | 
					            });
 | 
				
			||||||
 | 
					            Assert.NotNull(item2);
 | 
				
			||||||
 | 
					            Assert.Equal($"x{item.Id + 1}z-{item.CreateTime.ToString("yyyyMM")}{item.Title}{item.Title}", item2.str);
 | 
				
			||||||
 | 
					            Assert.Equal(string.Format("{0}x{0}z-{1}{2}{3}", item.Id + 1, item.CreateTime.ToString("yyyyMM"), item.Title, item.Title), item2.str2);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        [Fact]
 | 
					        [Fact]
 | 
				
			||||||
        public void Empty()
 | 
					        public void Empty()
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -73,6 +73,31 @@ WHERE (a.""ID"" = {item.Id})", sql);
 | 
				
			|||||||
            Assert.Equal(string.Format("{0}x{0}z-{1}{2}", item.Id + 1, item.CreateTime.ToString("yyyyMM"), item.Title), item2.str2);
 | 
					            Assert.Equal(string.Format("{0}x{0}z-{1}{2}", item.Id + 1, item.CreateTime.ToString("yyyyMM"), item.Title), item2.str2);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        [Fact]
 | 
				
			||||||
 | 
					        public void Format4()
 | 
				
			||||||
 | 
					        { 
 | 
				
			||||||
 | 
					            //3<><33> {} ʱ<><CAB1>Arguments <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿֿ<C7B7><D6BF><EFBFBD>
 | 
				
			||||||
 | 
					            //4<><34> {} ʱ<><CAB1>Arguments[1] ֻ<>ܽ<EFBFBD><DCBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȼ<EFBFBD><C8BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> NewArray []
 | 
				
			||||||
 | 
					            var item = g.shentong.GetRepository<Topic>().Insert(new Topic { Clicks = 101, Title = "<22><><EFBFBD><EFBFBD><EFBFBD>й<EFBFBD><D0B9><EFBFBD>101", CreateTime = DateTime.Parse("2020-7-5") });
 | 
				
			||||||
 | 
					            var sql = select.WhereDynamic(item).ToSql(a => new
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                str = $"x{a.Id + 1}z-{a.CreateTime.ToString("yyyyMM")}{a.Title}{a.Title}",
 | 
				
			||||||
 | 
					                str2 = string.Format("{0}x{0}z-{1}{2}{3}", a.Id + 1, a.CreateTime.ToString("yyyyMM"), a.Title, a.Title)
 | 
				
			||||||
 | 
					            });
 | 
				
			||||||
 | 
					            Assert.Equal($@"SELECT 'x'||coalesce((a.""ID"" + 1), '')||'z-'||coalesce(to_char((a.""CREATETIME"")::timestamp,'YYYYMM'), '')||''||coalesce(a.""TITLE"", '')||''||coalesce(a.""TITLE"", '')||'' as1, ''||coalesce((a.""ID"" + 1), '')||'x'||coalesce((a.""ID"" + 1), '')||'z-'||coalesce(to_char((a.""CREATETIME"")::timestamp,'YYYYMM'), '')||''||coalesce(a.""TITLE"", '')||''||coalesce(a.""TITLE"", '')||'' as2 
 | 
				
			||||||
 | 
					FROM ""TB_TOPIC"" a 
 | 
				
			||||||
 | 
					WHERE (a.""ID"" = {item.Id})", sql);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            var item2 = select.WhereDynamic(item).First(a => new
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                str = $"x{a.Id + 1}z-{a.CreateTime.ToString("yyyyMM")}{a.Title}{a.Title}",
 | 
				
			||||||
 | 
					                str2 = string.Format("{0}x{0}z-{1}{2}{3}", a.Id + 1, a.CreateTime.ToString("yyyyMM"), a.Title, a.Title)
 | 
				
			||||||
 | 
					            });
 | 
				
			||||||
 | 
					            Assert.NotNull(item2);
 | 
				
			||||||
 | 
					            Assert.Equal($"x{item.Id + 1}z-{item.CreateTime.ToString("yyyyMM")}{item.Title}{item.Title}", item2.str);
 | 
				
			||||||
 | 
					            Assert.Equal(string.Format("{0}x{0}z-{1}{2}{3}", item.Id + 1, item.CreateTime.ToString("yyyyMM"), item.Title, item.Title), item2.str2);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        [Fact]
 | 
					        [Fact]
 | 
				
			||||||
        public void Empty()
 | 
					        public void Empty()
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -88,6 +88,31 @@ WHERE (a.[Id] = {item.Id})", sql);
 | 
				
			|||||||
            Assert.Equal(string.Format("{0}x{0}z-{1}{2}", item.Id + 1, item.CreateTime.ToString("yyyyMM"), item.Title), item2.str2);
 | 
					            Assert.Equal(string.Format("{0}x{0}z-{1}{2}", item.Id + 1, item.CreateTime.ToString("yyyyMM"), item.Title), item2.str2);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        [Fact]
 | 
				
			||||||
 | 
					        public void Format4()
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            //3<><33> {} ʱ<><CAB1>Arguments <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿֿ<C7B7><D6BF><EFBFBD>
 | 
				
			||||||
 | 
					            //4<><34> {} ʱ<><CAB1>Arguments[1] ֻ<>ܽ<EFBFBD><DCBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȼ<EFBFBD><C8BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> NewArray []
 | 
				
			||||||
 | 
					            var item = g.sqlserver.GetRepository<Topic>().Insert(new Topic { Clicks = 101, Title = "<22><><EFBFBD><EFBFBD><EFBFBD>й<EFBFBD><D0B9><EFBFBD>101", CreateTime = DateTime.Parse("2020-7-5") });
 | 
				
			||||||
 | 
					            var sql = select.WhereDynamic(item).ToSql(a => new
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                str = $"x{a.Id + 1}z-{a.CreateTime.ToString("yyyyMM")}{a.Title}{a.Title}",
 | 
				
			||||||
 | 
					                str2 = string.Format("{0}x{0}z-{1}{2}{3}", a.Id + 1, a.CreateTime.ToString("yyyyMM"), a.Title, a.Title)
 | 
				
			||||||
 | 
					            });
 | 
				
			||||||
 | 
					            Assert.Equal($@"SELECT N'x'+isnull(cast((a.[Id] + 1) as varchar), '')+N'z-'+isnull(substring(convert(char(8), cast(a.[CreateTime] as datetime), 112), 1, 6), '')+N''+isnull(a.[Title], '')+N''+isnull(a.[Title], '')+N'' as1, N''+isnull(cast((a.[Id] + 1) as varchar), '')+N'x'+isnull(cast((a.[Id] + 1) as varchar), '')+N'z-'+isnull(substring(convert(char(8), cast(a.[CreateTime] as datetime), 112), 1, 6), '')+N''+isnull(a.[Title], '')+N''+isnull(a.[Title], '')+N'' as2 
 | 
				
			||||||
 | 
					FROM [tb_topic] a 
 | 
				
			||||||
 | 
					WHERE (a.[Id] = {item.Id})", sql);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            var item2 = select.WhereDynamic(item).First(a => new
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                str = $"x{a.Id + 1}z-{a.CreateTime.ToString("yyyyMM")}{a.Title}{a.Title}",
 | 
				
			||||||
 | 
					                str2 = string.Format("{0}x{0}z-{1}{2}{3}", a.Id + 1, a.CreateTime.ToString("yyyyMM"), a.Title, a.Title)
 | 
				
			||||||
 | 
					            });
 | 
				
			||||||
 | 
					            Assert.NotNull(item2);
 | 
				
			||||||
 | 
					            Assert.Equal($"x{item.Id + 1}z-{item.CreateTime.ToString("yyyyMM")}{item.Title}{item.Title}", item2.str);
 | 
				
			||||||
 | 
					            Assert.Equal(string.Format("{0}x{0}z-{1}{2}{3}", item.Id + 1, item.CreateTime.ToString("yyyyMM"), item.Title, item.Title), item2.str2);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        [Fact]
 | 
					        [Fact]
 | 
				
			||||||
        public void Empty()
 | 
					        public void Empty()
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -73,6 +73,31 @@ WHERE (a.""Id"" = {item.Id})", sql);
 | 
				
			|||||||
            Assert.Equal(string.Format("{0}x{0}z-{1}{2}", item.Id + 1, item.CreateTime.ToString("yyyyMM"), item.Title), item2.str2);
 | 
					            Assert.Equal(string.Format("{0}x{0}z-{1}{2}", item.Id + 1, item.CreateTime.ToString("yyyyMM"), item.Title), item2.str2);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        [Fact]
 | 
				
			||||||
 | 
					        public void Format4()
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            //3<><33> {} ʱ<><CAB1>Arguments <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿֿ<C7B7><D6BF><EFBFBD>
 | 
				
			||||||
 | 
					            //4<><34> {} ʱ<><CAB1>Arguments[1] ֻ<>ܽ<EFBFBD><DCBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȼ<EFBFBD><C8BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> NewArray []
 | 
				
			||||||
 | 
					            var item = g.sqlite.GetRepository<Topic>().Insert(new Topic { Clicks = 101, Title = "<22><><EFBFBD><EFBFBD><EFBFBD>й<EFBFBD><D0B9><EFBFBD>101", CreateTime = DateTime.Parse("2020-7-5") });
 | 
				
			||||||
 | 
					            var sql = select.WhereDynamic(item).ToSql(a => new
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                str = $"x{a.Id + 1}z-{a.CreateTime.ToString("yyyyMM")}{a.Title}{a.Title}",
 | 
				
			||||||
 | 
					                str2 = string.Format("{0}x{0}z-{1}{2}{3}", a.Id + 1, a.CreateTime.ToString("yyyyMM"), a.Title, a.Title)
 | 
				
			||||||
 | 
					            });
 | 
				
			||||||
 | 
					            Assert.Equal($@"SELECT 'x'||ifnull((a.""Id"" + 1), '')||'z-'||ifnull(strftime('%Y%m',a.""CreateTime""), '')||''||ifnull(a.""Title"", '')||''||ifnull(a.""Title"", '')||'' as1, ''||ifnull((a.""Id"" + 1), '')||'x'||ifnull((a.""Id"" + 1), '')||'z-'||ifnull(strftime('%Y%m',a.""CreateTime""), '')||''||ifnull(a.""Title"", '')||''||ifnull(a.""Title"", '')||'' as2 
 | 
				
			||||||
 | 
					FROM ""tb_topic"" a 
 | 
				
			||||||
 | 
					WHERE (a.""Id"" = {item.Id})", sql);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            var item2 = select.WhereDynamic(item).First(a => new
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                str = $"x{a.Id + 1}z-{a.CreateTime.ToString("yyyyMM")}{a.Title}{a.Title}",
 | 
				
			||||||
 | 
					                str2 = string.Format("{0}x{0}z-{1}{2}{3}", a.Id + 1, a.CreateTime.ToString("yyyyMM"), a.Title, a.Title)
 | 
				
			||||||
 | 
					            });
 | 
				
			||||||
 | 
					            Assert.NotNull(item2);
 | 
				
			||||||
 | 
					            Assert.Equal($"x{item.Id + 1}z-{item.CreateTime.ToString("yyyyMM")}{item.Title}{item.Title}", item2.str);
 | 
				
			||||||
 | 
					            Assert.Equal(string.Format("{0}x{0}z-{1}{2}{3}", item.Id + 1, item.CreateTime.ToString("yyyyMM"), item.Title, item.Title), item2.str2);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        [Fact]
 | 
					        [Fact]
 | 
				
			||||||
        public void Empty()
 | 
					        public void Empty()
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -252,7 +252,11 @@ namespace FreeSql.Dameng
 | 
				
			|||||||
                        return _common.StringConcat(exp.Arguments.Select(a => getExp(a)).ToArray(), null);
 | 
					                        return _common.StringConcat(exp.Arguments.Select(a => getExp(a)).ToArray(), null);
 | 
				
			||||||
                    case "Format":
 | 
					                    case "Format":
 | 
				
			||||||
                        if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception($"未实现函数表达式 {exp} 解析,参数 {exp.Arguments[0]} 必须为常量");
 | 
					                        if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception($"未实现函数表达式 {exp} 解析,参数 {exp.Arguments[0]} 必须为常量");
 | 
				
			||||||
                        var expArgs = exp.Arguments.Where((a, z) => z > 0).Select(a => $"'||{_common.IsNull(ExpressionLambdaToSql(a, tsc), "''")}||'").ToArray();
 | 
					                        var expArgsHack = exp.Arguments.Count == 2 && exp.Arguments[1].NodeType == ExpressionType.NewArrayInit ?
 | 
				
			||||||
 | 
					                            (exp.Arguments[1] as NewArrayExpression).Expressions : exp.Arguments.Where((a, z) => z > 0);
 | 
				
			||||||
 | 
					                        //3个 {} 时,Arguments 解析出来是分开的
 | 
				
			||||||
 | 
					                        //4个 {} 时,Arguments[1] 只能解析这个出来,然后里面是 NewArray []
 | 
				
			||||||
 | 
					                        var expArgs = expArgsHack.Select(a => $"'||{_common.IsNull(ExpressionLambdaToSql(a, tsc), "''")}||'").ToArray();
 | 
				
			||||||
                        return string.Format(ExpressionLambdaToSql(exp.Arguments[0], tsc), expArgs);
 | 
					                        return string.Format(ExpressionLambdaToSql(exp.Arguments[0], tsc), expArgs);
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -222,7 +222,11 @@ namespace FreeSql.MsAccess
 | 
				
			|||||||
                        return _common.StringConcat(exp.Arguments.Select(a => getExp(a)).ToArray(), exp.Arguments.Select(a => a.Type).ToArray());
 | 
					                        return _common.StringConcat(exp.Arguments.Select(a => getExp(a)).ToArray(), exp.Arguments.Select(a => a.Type).ToArray());
 | 
				
			||||||
                    case "Format":
 | 
					                    case "Format":
 | 
				
			||||||
                        if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception($"未实现函数表达式 {exp} 解析,参数 {exp.Arguments[0]} 必须为常量");
 | 
					                        if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception($"未实现函数表达式 {exp} 解析,参数 {exp.Arguments[0]} 必须为常量");
 | 
				
			||||||
                        var expArgs = exp.Arguments.Where((a, z) => z > 0).Select(a =>
 | 
					                        var expArgsHack = exp.Arguments.Count == 2 && exp.Arguments[1].NodeType == ExpressionType.NewArrayInit ?
 | 
				
			||||||
 | 
					                            (exp.Arguments[1] as NewArrayExpression).Expressions : exp.Arguments.Where((a, z) => z > 0);
 | 
				
			||||||
 | 
					                        //3个 {} 时,Arguments 解析出来是分开的
 | 
				
			||||||
 | 
					                        //4个 {} 时,Arguments[1] 只能解析这个出来,然后里面是 NewArray []
 | 
				
			||||||
 | 
					                        var expArgs = expArgsHack.Select(a =>
 | 
				
			||||||
                        {
 | 
					                        {
 | 
				
			||||||
                            var asql = ((a as UnaryExpression)?.Operand.Type ?? a.Type) == typeof(string) ? $"{ExpressionLambdaToSql(a, tsc)}" : $"cstr({ExpressionLambdaToSql(a, tsc)})";
 | 
					                            var asql = ((a as UnaryExpression)?.Operand.Type ?? a.Type) == typeof(string) ? $"{ExpressionLambdaToSql(a, tsc)}" : $"cstr({ExpressionLambdaToSql(a, tsc)})";
 | 
				
			||||||
                            return $"'+{_common.IsNull(asql, "''")}+'";
 | 
					                            return $"'+{_common.IsNull(asql, "''")}+'";
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -251,7 +251,11 @@ namespace FreeSql.MySql
 | 
				
			|||||||
                    case "Format":
 | 
					                    case "Format":
 | 
				
			||||||
                        if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception($"未实现函数表达式 {exp} 解析,参数 {exp.Arguments[0]} 必须为常量");
 | 
					                        if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception($"未实现函数表达式 {exp} 解析,参数 {exp.Arguments[0]} 必须为常量");
 | 
				
			||||||
                        if (exp.Arguments.Count == 1) return ExpressionLambdaToSql(exp.Arguments[0], tsc);
 | 
					                        if (exp.Arguments.Count == 1) return ExpressionLambdaToSql(exp.Arguments[0], tsc);
 | 
				
			||||||
                        var expArgs = exp.Arguments.Where((a, z) => z > 0).Select(a => $"',{_common.IsNull(ExpressionLambdaToSql(a, tsc), "''")},'").ToArray();
 | 
					                        var expArgsHack = exp.Arguments.Count == 2 && exp.Arguments[1].NodeType == ExpressionType.NewArrayInit ?
 | 
				
			||||||
 | 
					                            (exp.Arguments[1] as NewArrayExpression).Expressions : exp.Arguments.Where((a, z) => z > 0);
 | 
				
			||||||
 | 
					                        //3个 {} 时,Arguments 解析出来是分开的
 | 
				
			||||||
 | 
					                        //4个 {} 时,Arguments[1] 只能解析这个出来,然后里面是 NewArray []
 | 
				
			||||||
 | 
					                        var expArgs = expArgsHack.Select(a => $"',{_common.IsNull(ExpressionLambdaToSql(a, tsc), "''")},'").ToArray();
 | 
				
			||||||
                        return $"concat({string.Format(ExpressionLambdaToSql(exp.Arguments[0], tsc), expArgs)})";
 | 
					                        return $"concat({string.Format(ExpressionLambdaToSql(exp.Arguments[0], tsc), expArgs)})";
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -252,7 +252,11 @@ namespace FreeSql.Odbc.Dameng
 | 
				
			|||||||
                        return _common.StringConcat(exp.Arguments.Select(a => getExp(a)).ToArray(), null);
 | 
					                        return _common.StringConcat(exp.Arguments.Select(a => getExp(a)).ToArray(), null);
 | 
				
			||||||
                    case "Format":
 | 
					                    case "Format":
 | 
				
			||||||
                        if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception($"未实现函数表达式 {exp} 解析,参数 {exp.Arguments[0]} 必须为常量");
 | 
					                        if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception($"未实现函数表达式 {exp} 解析,参数 {exp.Arguments[0]} 必须为常量");
 | 
				
			||||||
                        var expArgs = exp.Arguments.Where((a, z) => z > 0).Select(a => $"'||{_common.IsNull(ExpressionLambdaToSql(a, tsc), "''")}||'").ToArray();
 | 
					                        var expArgsHack = exp.Arguments.Count == 2 && exp.Arguments[1].NodeType == ExpressionType.NewArrayInit ?
 | 
				
			||||||
 | 
					                            (exp.Arguments[1] as NewArrayExpression).Expressions : exp.Arguments.Where((a, z) => z > 0);
 | 
				
			||||||
 | 
					                        //3个 {} 时,Arguments 解析出来是分开的
 | 
				
			||||||
 | 
					                        //4个 {} 时,Arguments[1] 只能解析这个出来,然后里面是 NewArray []
 | 
				
			||||||
 | 
					                        var expArgs = expArgsHack.Select(a => $"'||{_common.IsNull(ExpressionLambdaToSql(a, tsc), "''")}||'").ToArray();
 | 
				
			||||||
                        return string.Format(ExpressionLambdaToSql(exp.Arguments[0], tsc), expArgs);
 | 
					                        return string.Format(ExpressionLambdaToSql(exp.Arguments[0], tsc), expArgs);
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -316,7 +316,11 @@ namespace FreeSql.Odbc.KingbaseES
 | 
				
			|||||||
                        return _common.StringConcat(exp.Arguments.Select(a => getExp(a)).ToArray(), null);
 | 
					                        return _common.StringConcat(exp.Arguments.Select(a => getExp(a)).ToArray(), null);
 | 
				
			||||||
                    case "Format":
 | 
					                    case "Format":
 | 
				
			||||||
                        if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception($"未实现函数表达式 {exp} 解析,参数 {exp.Arguments[0]} 必须为常量");
 | 
					                        if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception($"未实现函数表达式 {exp} 解析,参数 {exp.Arguments[0]} 必须为常量");
 | 
				
			||||||
                        var expArgs = exp.Arguments.Where((a, z) => z > 0).Select(a =>
 | 
					                        var expArgsHack = exp.Arguments.Count == 2 && exp.Arguments[1].NodeType == ExpressionType.NewArrayInit ?
 | 
				
			||||||
 | 
					                            (exp.Arguments[1] as NewArrayExpression).Expressions : exp.Arguments.Where((a, z) => z > 0);
 | 
				
			||||||
 | 
					                        //3个 {} 时,Arguments 解析出来是分开的
 | 
				
			||||||
 | 
					                        //4个 {} 时,Arguments[1] 只能解析这个出来,然后里面是 NewArray []
 | 
				
			||||||
 | 
					                        var expArgs = expArgsHack.Select(a =>
 | 
				
			||||||
                        {
 | 
					                        {
 | 
				
			||||||
                            var atype = (a as UnaryExpression)?.Operand.Type.NullableTypeOrThis() ?? a.Type.NullableTypeOrThis();
 | 
					                            var atype = (a as UnaryExpression)?.Operand.Type.NullableTypeOrThis() ?? a.Type.NullableTypeOrThis();
 | 
				
			||||||
                            if (atype == typeof(string)) return $"'||{_common.IsNull(ExpressionLambdaToSql(a, tsc), "''")}||'";
 | 
					                            if (atype == typeof(string)) return $"'||{_common.IsNull(ExpressionLambdaToSql(a, tsc), "''")}||'";
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -249,7 +249,11 @@ namespace FreeSql.Odbc.MySql
 | 
				
			|||||||
                    case "Format":
 | 
					                    case "Format":
 | 
				
			||||||
                        if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception($"未实现函数表达式 {exp} 解析,参数 {exp.Arguments[0]} 必须为常量");
 | 
					                        if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception($"未实现函数表达式 {exp} 解析,参数 {exp.Arguments[0]} 必须为常量");
 | 
				
			||||||
                        if (exp.Arguments.Count == 1) return ExpressionLambdaToSql(exp.Arguments[0], tsc);
 | 
					                        if (exp.Arguments.Count == 1) return ExpressionLambdaToSql(exp.Arguments[0], tsc);
 | 
				
			||||||
                        var expArgs = exp.Arguments.Where((a, z) => z > 0).Select(a => $"',{_common.IsNull(ExpressionLambdaToSql(a, tsc), "''")},'").ToArray();
 | 
					                        var expArgsHack = exp.Arguments.Count == 2 && exp.Arguments[1].NodeType == ExpressionType.NewArrayInit ?
 | 
				
			||||||
 | 
					                            (exp.Arguments[1] as NewArrayExpression).Expressions : exp.Arguments.Where((a, z) => z > 0);
 | 
				
			||||||
 | 
					                        //3个 {} 时,Arguments 解析出来是分开的
 | 
				
			||||||
 | 
					                        //4个 {} 时,Arguments[1] 只能解析这个出来,然后里面是 NewArray []
 | 
				
			||||||
 | 
					                        var expArgs = expArgsHack.Select(a => $"',{_common.IsNull(ExpressionLambdaToSql(a, tsc), "''")},'").ToArray();
 | 
				
			||||||
                        return $"concat({string.Format(ExpressionLambdaToSql(exp.Arguments[0], tsc), expArgs)})";
 | 
					                        return $"concat({string.Format(ExpressionLambdaToSql(exp.Arguments[0], tsc), expArgs)})";
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -252,7 +252,11 @@ namespace FreeSql.Odbc.Oracle
 | 
				
			|||||||
                        return _common.StringConcat(exp.Arguments.Select(a => getExp(a)).ToArray(), null);
 | 
					                        return _common.StringConcat(exp.Arguments.Select(a => getExp(a)).ToArray(), null);
 | 
				
			||||||
                    case "Format":
 | 
					                    case "Format":
 | 
				
			||||||
                        if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception($"未实现函数表达式 {exp} 解析,参数 {exp.Arguments[0]} 必须为常量");
 | 
					                        if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception($"未实现函数表达式 {exp} 解析,参数 {exp.Arguments[0]} 必须为常量");
 | 
				
			||||||
                        var expArgs = exp.Arguments.Where((a, z) => z > 0).Select(a => $"'||{_common.IsNull(ExpressionLambdaToSql(a, tsc), "''")}||'").ToArray();
 | 
					                        var expArgsHack = exp.Arguments.Count == 2 && exp.Arguments[1].NodeType == ExpressionType.NewArrayInit ?
 | 
				
			||||||
 | 
					                            (exp.Arguments[1] as NewArrayExpression).Expressions : exp.Arguments.Where((a, z) => z > 0);
 | 
				
			||||||
 | 
					                        //3个 {} 时,Arguments 解析出来是分开的
 | 
				
			||||||
 | 
					                        //4个 {} 时,Arguments[1] 只能解析这个出来,然后里面是 NewArray []
 | 
				
			||||||
 | 
					                        var expArgs = expArgsHack.Select(a => $"'||{_common.IsNull(ExpressionLambdaToSql(a, tsc), "''")}||'").ToArray();
 | 
				
			||||||
                        return string.Format(ExpressionLambdaToSql(exp.Arguments[0], tsc), expArgs);
 | 
					                        return string.Format(ExpressionLambdaToSql(exp.Arguments[0], tsc), expArgs);
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -338,7 +338,11 @@ namespace FreeSql.Odbc.PostgreSQL
 | 
				
			|||||||
                        return _common.StringConcat(exp.Arguments.Select(a => getExp(a)).ToArray(), null);
 | 
					                        return _common.StringConcat(exp.Arguments.Select(a => getExp(a)).ToArray(), null);
 | 
				
			||||||
                    case "Format":
 | 
					                    case "Format":
 | 
				
			||||||
                        if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception($"未实现函数表达式 {exp} 解析,参数 {exp.Arguments[0]} 必须为常量");
 | 
					                        if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception($"未实现函数表达式 {exp} 解析,参数 {exp.Arguments[0]} 必须为常量");
 | 
				
			||||||
                        var expArgs = exp.Arguments.Where((a, z) => z > 0).Select(a =>
 | 
					                        var expArgsHack = exp.Arguments.Count == 2 && exp.Arguments[1].NodeType == ExpressionType.NewArrayInit ?
 | 
				
			||||||
 | 
					                            (exp.Arguments[1] as NewArrayExpression).Expressions : exp.Arguments.Where((a, z) => z > 0);
 | 
				
			||||||
 | 
					                        //3个 {} 时,Arguments 解析出来是分开的
 | 
				
			||||||
 | 
					                        //4个 {} 时,Arguments[1] 只能解析这个出来,然后里面是 NewArray []
 | 
				
			||||||
 | 
					                        var expArgs = expArgsHack.Select(a =>
 | 
				
			||||||
                        {
 | 
					                        {
 | 
				
			||||||
                            var atype = (a as UnaryExpression)?.Operand.Type.NullableTypeOrThis() ?? a.Type.NullableTypeOrThis();
 | 
					                            var atype = (a as UnaryExpression)?.Operand.Type.NullableTypeOrThis() ?? a.Type.NullableTypeOrThis();
 | 
				
			||||||
                            if (atype == typeof(string)) return $"'||{_common.IsNull(ExpressionLambdaToSql(a, tsc), "''")}||'";
 | 
					                            if (atype == typeof(string)) return $"'||{_common.IsNull(ExpressionLambdaToSql(a, tsc), "''")}||'";
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -261,7 +261,11 @@ namespace FreeSql.Odbc.SqlServer
 | 
				
			|||||||
                        var expArgs0 = ExpressionLambdaToSql(exp.Arguments[0], tsc);
 | 
					                        var expArgs0 = ExpressionLambdaToSql(exp.Arguments[0], tsc);
 | 
				
			||||||
                        if (exp.Arguments.Count == 1) return expArgs0;
 | 
					                        if (exp.Arguments.Count == 1) return expArgs0;
 | 
				
			||||||
                        var nchar = expArgs0.StartsWith("N'") ? "N" : "";
 | 
					                        var nchar = expArgs0.StartsWith("N'") ? "N" : "";
 | 
				
			||||||
                        var expArgs = exp.Arguments.Where((a, z) => z > 0).Select(a =>
 | 
					                        var expArgsHack = exp.Arguments.Count == 2 && exp.Arguments[1].NodeType == ExpressionType.NewArrayInit ?
 | 
				
			||||||
 | 
					                            (exp.Arguments[1] as NewArrayExpression).Expressions : exp.Arguments.Where((a, z) => z > 0);
 | 
				
			||||||
 | 
					                        //3个 {} 时,Arguments 解析出来是分开的
 | 
				
			||||||
 | 
					                        //4个 {} 时,Arguments[1] 只能解析这个出来,然后里面是 NewArray []
 | 
				
			||||||
 | 
					                        var expArgs = expArgsHack.Select(a =>
 | 
				
			||||||
                        {
 | 
					                        {
 | 
				
			||||||
                            var atype = (a as UnaryExpression)?.Operand.Type.NullableTypeOrThis() ?? a.Type.NullableTypeOrThis();
 | 
					                            var atype = (a as UnaryExpression)?.Operand.Type.NullableTypeOrThis() ?? a.Type.NullableTypeOrThis();
 | 
				
			||||||
                            if (atype == typeof(string)) return $"'+{_common.IsNull(ExpressionLambdaToSql(a, tsc), "''")}+{nchar}'";
 | 
					                            if (atype == typeof(string)) return $"'+{_common.IsNull(ExpressionLambdaToSql(a, tsc), "''")}+{nchar}'";
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -252,7 +252,11 @@ namespace FreeSql.Oracle
 | 
				
			|||||||
                        return _common.StringConcat(exp.Arguments.Select(a => getExp(a)).ToArray(), null);
 | 
					                        return _common.StringConcat(exp.Arguments.Select(a => getExp(a)).ToArray(), null);
 | 
				
			||||||
                    case "Format":
 | 
					                    case "Format":
 | 
				
			||||||
                        if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception($"未实现函数表达式 {exp} 解析,参数 {exp.Arguments[0]} 必须为常量");
 | 
					                        if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception($"未实现函数表达式 {exp} 解析,参数 {exp.Arguments[0]} 必须为常量");
 | 
				
			||||||
                        var expArgs = exp.Arguments.Where((a, z) => z > 0).Select(a => $"'||{_common.IsNull(ExpressionLambdaToSql(a, tsc), "''")}||'").ToArray();
 | 
					                        var expArgsHack = exp.Arguments.Count == 2 && exp.Arguments[1].NodeType == ExpressionType.NewArrayInit ?
 | 
				
			||||||
 | 
					                            (exp.Arguments[1] as NewArrayExpression).Expressions : exp.Arguments.Where((a, z) => z > 0);
 | 
				
			||||||
 | 
					                        //3个 {} 时,Arguments 解析出来是分开的
 | 
				
			||||||
 | 
					                        //4个 {} 时,Arguments[1] 只能解析这个出来,然后里面是 NewArray []
 | 
				
			||||||
 | 
					                        var expArgs = expArgsHack.Select(a => $"'||{_common.IsNull(ExpressionLambdaToSql(a, tsc), "''")}||'").ToArray();
 | 
				
			||||||
                        return string.Format(ExpressionLambdaToSql(exp.Arguments[0], tsc), expArgs);
 | 
					                        return string.Format(ExpressionLambdaToSql(exp.Arguments[0], tsc), expArgs);
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -369,7 +369,11 @@ namespace FreeSql.PostgreSQL
 | 
				
			|||||||
                        return _common.StringConcat(exp.Arguments.Select(a => getExp(a)).ToArray(), null);
 | 
					                        return _common.StringConcat(exp.Arguments.Select(a => getExp(a)).ToArray(), null);
 | 
				
			||||||
                    case "Format":
 | 
					                    case "Format":
 | 
				
			||||||
                        if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception($"未实现函数表达式 {exp} 解析,参数 {exp.Arguments[0]} 必须为常量");
 | 
					                        if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception($"未实现函数表达式 {exp} 解析,参数 {exp.Arguments[0]} 必须为常量");
 | 
				
			||||||
                        var expArgs = exp.Arguments.Where((a, z) => z > 0).Select(a =>
 | 
					                        var expArgsHack = exp.Arguments.Count == 2 && exp.Arguments[1].NodeType == ExpressionType.NewArrayInit ?
 | 
				
			||||||
 | 
					                            (exp.Arguments[1] as NewArrayExpression).Expressions : exp.Arguments.Where((a, z) => z > 0);
 | 
				
			||||||
 | 
					                        //3个 {} 时,Arguments 解析出来是分开的
 | 
				
			||||||
 | 
					                        //4个 {} 时,Arguments[1] 只能解析这个出来,然后里面是 NewArray []
 | 
				
			||||||
 | 
					                        var expArgs = expArgsHack.Select(a =>
 | 
				
			||||||
                        {
 | 
					                        {
 | 
				
			||||||
                            var atype = (a as UnaryExpression)?.Operand.Type.NullableTypeOrThis() ?? a.Type.NullableTypeOrThis();
 | 
					                            var atype = (a as UnaryExpression)?.Operand.Type.NullableTypeOrThis() ?? a.Type.NullableTypeOrThis();
 | 
				
			||||||
                            if (atype == typeof(string)) return $"'||{_common.IsNull(ExpressionLambdaToSql(a, tsc), "''")}||'";
 | 
					                            if (atype == typeof(string)) return $"'||{_common.IsNull(ExpressionLambdaToSql(a, tsc), "''")}||'";
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -299,7 +299,11 @@ namespace FreeSql.ShenTong
 | 
				
			|||||||
                        return _common.StringConcat(exp.Arguments.Select(a => getExp(a)).ToArray(), null);
 | 
					                        return _common.StringConcat(exp.Arguments.Select(a => getExp(a)).ToArray(), null);
 | 
				
			||||||
                    case "Format":
 | 
					                    case "Format":
 | 
				
			||||||
                        if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception($"未实现函数表达式 {exp} 解析,参数 {exp.Arguments[0]} 必须为常量");
 | 
					                        if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception($"未实现函数表达式 {exp} 解析,参数 {exp.Arguments[0]} 必须为常量");
 | 
				
			||||||
                        var expArgs = exp.Arguments.Where((a, z) => z > 0).Select(a => $"'||{_common.IsNull(ExpressionLambdaToSql(a, tsc), "''")}||'").ToArray();
 | 
					                        var expArgsHack = exp.Arguments.Count == 2 && exp.Arguments[1].NodeType == ExpressionType.NewArrayInit ?
 | 
				
			||||||
 | 
					                             (exp.Arguments[1] as NewArrayExpression).Expressions : exp.Arguments.Where((a, z) => z > 0);
 | 
				
			||||||
 | 
					                        //3个 {} 时,Arguments 解析出来是分开的
 | 
				
			||||||
 | 
					                        //4个 {} 时,Arguments[1] 只能解析这个出来,然后里面是 NewArray []
 | 
				
			||||||
 | 
					                        var expArgs = expArgsHack.Select(a => $"'||{_common.IsNull(ExpressionLambdaToSql(a, tsc), "''")}||'").ToArray();
 | 
				
			||||||
                        return string.Format(ExpressionLambdaToSql(exp.Arguments[0], tsc), expArgs);
 | 
					                        return string.Format(ExpressionLambdaToSql(exp.Arguments[0], tsc), expArgs);
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -260,7 +260,11 @@ namespace FreeSql.SqlServer
 | 
				
			|||||||
                        var expArgs0 = ExpressionLambdaToSql(exp.Arguments[0], tsc);
 | 
					                        var expArgs0 = ExpressionLambdaToSql(exp.Arguments[0], tsc);
 | 
				
			||||||
                        if (exp.Arguments.Count == 1) return expArgs0;
 | 
					                        if (exp.Arguments.Count == 1) return expArgs0;
 | 
				
			||||||
                        var nchar = expArgs0.StartsWith("N'") ? "N" : "";
 | 
					                        var nchar = expArgs0.StartsWith("N'") ? "N" : "";
 | 
				
			||||||
                        var expArgs = exp.Arguments.Where((a, z) => z > 0).Select(a =>
 | 
					                        var expArgsHack = exp.Arguments.Count == 2 && exp.Arguments[1].NodeType == ExpressionType.NewArrayInit ?
 | 
				
			||||||
 | 
					                            (exp.Arguments[1] as NewArrayExpression).Expressions : exp.Arguments.Where((a, z) => z > 0);
 | 
				
			||||||
 | 
					                        //3个 {} 时,Arguments 解析出来是分开的
 | 
				
			||||||
 | 
					                        //4个 {} 时,Arguments[1] 只能解析这个出来,然后里面是 NewArray []
 | 
				
			||||||
 | 
					                        var expArgs = expArgsHack.Select(a =>
 | 
				
			||||||
                        {
 | 
					                        {
 | 
				
			||||||
                            var atype = (a as UnaryExpression)?.Operand.Type.NullableTypeOrThis() ?? a.Type.NullableTypeOrThis();
 | 
					                            var atype = (a as UnaryExpression)?.Operand.Type.NullableTypeOrThis() ?? a.Type.NullableTypeOrThis();
 | 
				
			||||||
                            if (atype == typeof(string)) return $"'+{_common.IsNull(ExpressionLambdaToSql(a, tsc), "''")}+{nchar}'";
 | 
					                            if (atype == typeof(string)) return $"'+{_common.IsNull(ExpressionLambdaToSql(a, tsc), "''")}+{nchar}'";
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -248,7 +248,11 @@ namespace FreeSql.Sqlite
 | 
				
			|||||||
                        return _common.StringConcat(exp.Arguments.Select(a => getExp(a)).ToArray(), null);
 | 
					                        return _common.StringConcat(exp.Arguments.Select(a => getExp(a)).ToArray(), null);
 | 
				
			||||||
                    case "Format":
 | 
					                    case "Format":
 | 
				
			||||||
                        if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception($"未实现函数表达式 {exp} 解析,参数 {exp.Arguments[0]} 必须为常量");
 | 
					                        if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception($"未实现函数表达式 {exp} 解析,参数 {exp.Arguments[0]} 必须为常量");
 | 
				
			||||||
                        var expArgs = exp.Arguments.Where((a, z) => z > 0).Select(a => $"'||{_common.IsNull(ExpressionLambdaToSql(a, tsc), "''")}||'").ToArray();
 | 
					                        var expArgsHack = exp.Arguments.Count == 2 && exp.Arguments[1].NodeType == ExpressionType.NewArrayInit ?
 | 
				
			||||||
 | 
					                            (exp.Arguments[1] as NewArrayExpression).Expressions : exp.Arguments.Where((a, z) => z > 0);
 | 
				
			||||||
 | 
					                        //3个 {} 时,Arguments 解析出来是分开的
 | 
				
			||||||
 | 
					                        //4个 {} 时,Arguments[1] 只能解析这个出来,然后里面是 NewArray []
 | 
				
			||||||
 | 
					                        var expArgs = expArgsHack.Select(a => $"'||{_common.IsNull(ExpressionLambdaToSql(a, tsc), "''")}||'").ToArray();
 | 
				
			||||||
                        return string.Format(ExpressionLambdaToSql(exp.Arguments[0], tsc), expArgs);
 | 
					                        return string.Format(ExpressionLambdaToSql(exp.Arguments[0], tsc), expArgs);
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user