mirror of
				https://github.com/nsnail/FreeSql.git
				synced 2025-11-04 09:15:27 +08:00 
			
		
		
		
	- 修复 pgsql Dto 映射使用常量 false 转换失败;
This commit is contained in:
		@@ -266,6 +266,11 @@ WHERE (((a.""name"") in (SELECT s.""title"" as1
 | 
				
			|||||||
            public int id { get; set; }
 | 
					            public int id { get; set; }
 | 
				
			||||||
            public string name { get; set; } //这是join表的属性
 | 
					            public string name { get; set; } //这是join表的属性
 | 
				
			||||||
            public int ParentId { get; set; } //这是join表的属性
 | 
					            public int ParentId { get; set; } //这是join表的属性
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            public bool? testBool1 { get; set; }
 | 
				
			||||||
 | 
					            public bool? testBool2 { get; set; }
 | 
				
			||||||
 | 
					            public bool testBool3 { get; set; }
 | 
				
			||||||
 | 
					            public bool testBool4 { get; set; }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        class TestDto2
 | 
					        class TestDto2
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
@@ -283,8 +288,11 @@ WHERE (((a.""name"") in (SELECT s.""title"" as1
 | 
				
			|||||||
        [Fact]
 | 
					        [Fact]
 | 
				
			||||||
        public void ToList()
 | 
					        public void ToList()
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
 | 
					            var testDto1 = select.Limit(10).ToList(a => new TestDto { id = a.Id, name = a.Title, testBool1 = false, testBool2 = true, testBool3 = false, testBool4 = true });
 | 
				
			||||||
            var testDto1 = select.Limit(10).ToList(a => new TestDto { id = a.Id, name = a.Title });
 | 
					            Assert.False(testDto1[0].testBool1);
 | 
				
			||||||
 | 
					            Assert.True(testDto1[0].testBool2);
 | 
				
			||||||
 | 
					            Assert.False(testDto1[0].testBool3);
 | 
				
			||||||
 | 
					            Assert.True(testDto1[0].testBool4);
 | 
				
			||||||
            var testDto2 = select.Limit(10).ToList(a => new TestDto());
 | 
					            var testDto2 = select.Limit(10).ToList(a => new TestDto());
 | 
				
			||||||
            var testDto3 = select.Limit(10).ToList(a => new TestDto { });
 | 
					            var testDto3 = select.Limit(10).ToList(a => new TestDto { });
 | 
				
			||||||
            var testDto4 = select.Limit(10).ToList(a => new TestDto() { });
 | 
					            var testDto4 = select.Limit(10).ToList(a => new TestDto() { });
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -281,6 +281,8 @@ WHERE (((a.""Name"") in (SELECT s.""Title"" as1
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            public bool? testBool1 { get; set; }
 | 
					            public bool? testBool1 { get; set; }
 | 
				
			||||||
            public bool? testBool2 { get; set; }
 | 
					            public bool? testBool2 { get; set; }
 | 
				
			||||||
 | 
					            public bool testBool3 { get; set; }
 | 
				
			||||||
 | 
					            public bool testBool4 { get; set; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            public TestDtoLeftJoin Obj { get; set; }
 | 
					            public TestDtoLeftJoin Obj { get; set; }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
@@ -346,7 +348,11 @@ WHERE (((a.""Name"") in (SELECT s.""Title"" as1
 | 
				
			|||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            select.Limit(10).ToList(a => new TestDto { id = a.Id, name = a.Title });
 | 
					            select.Limit(10).ToList(a => new TestDto { id = a.Id, name = a.Title });
 | 
				
			||||||
            var testDto1 = select.Limit(10).ToList(a => new TestDto { id = a.Id, name = a.Title });
 | 
					            var testDto1 = select.Limit(10).ToList(a => new TestDto { id = a.Id, name = a.Title, testBool1 = false, testBool2 = true, testBool3 = false, testBool4 = true });
 | 
				
			||||||
 | 
					            Assert.False(testDto1[0].testBool1);
 | 
				
			||||||
 | 
					            Assert.True(testDto1[0].testBool2);
 | 
				
			||||||
 | 
					            Assert.False(testDto1[0].testBool3);
 | 
				
			||||||
 | 
					            Assert.True(testDto1[0].testBool4);
 | 
				
			||||||
            var testDto2 = select.Limit(10).ToList(a => new TestDto());
 | 
					            var testDto2 = select.Limit(10).ToList(a => new TestDto());
 | 
				
			||||||
            var testDto3 = select.Limit(10).ToList(a => new TestDto { });
 | 
					            var testDto3 = select.Limit(10).ToList(a => new TestDto { });
 | 
				
			||||||
            var testDto4 = select.Limit(10).ToList(a => new TestDto() { });
 | 
					            var testDto4 = select.Limit(10).ToList(a => new TestDto() { });
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -2298,7 +2298,9 @@ namespace FreeSql.Internal
 | 
				
			|||||||
                                        Expression.Equal(Expression.Convert(valueExp, typeof(string)), Expression.Constant("False")),
 | 
					                                        Expression.Equal(Expression.Convert(valueExp, typeof(string)), Expression.Constant("False")),
 | 
				
			||||||
                                        Expression.OrElse(
 | 
					                                        Expression.OrElse(
 | 
				
			||||||
                                            Expression.Equal(Expression.Convert(valueExp, typeof(string)), Expression.Constant("false")),
 | 
					                                            Expression.Equal(Expression.Convert(valueExp, typeof(string)), Expression.Constant("false")),
 | 
				
			||||||
                                            Expression.Equal(Expression.Convert(valueExp, typeof(string)), Expression.Constant("0"))))),
 | 
					                                            Expression.OrElse(
 | 
				
			||||||
 | 
					                                                Expression.Equal(Expression.Convert(valueExp, typeof(string)), Expression.Constant("f")),
 | 
				
			||||||
 | 
					                                                Expression.Equal(Expression.Convert(valueExp, typeof(string)), Expression.Constant("0")))))),
 | 
				
			||||||
                            typeof(object))
 | 
					                            typeof(object))
 | 
				
			||||||
                        );
 | 
					                        );
 | 
				
			||||||
                        break;
 | 
					                        break;
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user