mirror of
				https://github.com/nsnail/FreeSql.git
				synced 2025-11-04 17:20:49 +08:00 
			
		
		
		
	- 修复 IsNulable 特性不生效的 bug; #137
This commit is contained in:
		@@ -165,9 +165,27 @@ namespace FreeSql.Tests
 | 
				
			|||||||
            public long? CreateUserId { get; set; }
 | 
					            public long? CreateUserId { get; set; }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        public class TestMySqlStringIsNullable
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            public Guid id { get; set; }
 | 
				
			||||||
 | 
					            public string varchar { get; set; }
 | 
				
			||||||
 | 
					            [Column(IsNullable = true)]
 | 
				
			||||||
 | 
					            public string varchar_null { get; set; }
 | 
				
			||||||
 | 
					            [Column(IsNullable = false)]
 | 
				
			||||||
 | 
					            public string varchar_notnull { get; set; }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        [Fact]
 | 
					        [Fact]
 | 
				
			||||||
        public void Test02()
 | 
					        public void Test02()
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
 | 
					            g.mysql.Select<TestMySqlStringIsNullable>();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            var slsksd = g.mysql.Update<UserLike>().SetSource(new UserLike { Id = Guid.NewGuid(), CreateUserId = 1000, SubjectId = Guid.NewGuid() })
 | 
				
			||||||
 | 
					                .UpdateColumns(a => new
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    a.SubjectId
 | 
				
			||||||
 | 
					                }).NoneParameter().ToSql();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            g.mysql.Aop.ParseExpression = (s, e) =>
 | 
					            g.mysql.Aop.ParseExpression = (s, e) =>
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                if (e.Expression.NodeType == ExpressionType.Call)
 | 
					                if (e.Expression.NodeType == ExpressionType.Call)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -114,7 +114,7 @@ namespace FreeSql.Internal
 | 
				
			|||||||
                else
 | 
					                else
 | 
				
			||||||
                    colattr.DbType = colattr.DbType.ToUpper();
 | 
					                    colattr.DbType = colattr.DbType.ToUpper();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                if (tp != null && tp.Value.isnullable == null) colattr.IsNullable = tp.Value.dbtypeFull.Contains("NOT NULL") == false;
 | 
					                if (colattr._IsNullable == null && tp != null && tp.Value.isnullable == null) colattr.IsNullable = tp.Value.dbtypeFull.Contains("NOT NULL") == false;
 | 
				
			||||||
                if (colattr.DbType?.Contains("NOT NULL") == true) colattr.IsNullable = false;
 | 
					                if (colattr.DbType?.Contains("NOT NULL") == true) colattr.IsNullable = false;
 | 
				
			||||||
                if (string.IsNullOrEmpty(colattr.Name)) colattr.Name = p.Name;
 | 
					                if (string.IsNullOrEmpty(colattr.Name)) colattr.Name = p.Name;
 | 
				
			||||||
                if (common.CodeFirst.IsSyncStructureToLower) colattr.Name = colattr.Name.ToLower();
 | 
					                if (common.CodeFirst.IsSyncStructureToLower) colattr.Name = colattr.Name.ToLower();
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user