mirror of
				https://github.com/nsnail/FreeSql.git
				synced 2025-11-04 17:20:49 +08:00 
			
		
		
		
	add TestCode #521
This commit is contained in:
		
							
								
								
									
										48
									
								
								FreeSql.Tests/FreeSql.Tests/Issues/521.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										48
									
								
								FreeSql.Tests/FreeSql.Tests/Issues/521.cs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,48 @@
 | 
			
		||||
using FreeSql.DataAnnotations;
 | 
			
		||||
using Newtonsoft.Json;
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.ComponentModel;
 | 
			
		||||
using System.ComponentModel.DataAnnotations;
 | 
			
		||||
using System.Diagnostics;
 | 
			
		||||
using System.Text;
 | 
			
		||||
using System.Threading;
 | 
			
		||||
using Xunit;
 | 
			
		||||
 | 
			
		||||
namespace FreeSql.Tests.Issues
 | 
			
		||||
{
 | 
			
		||||
    public class _521
 | 
			
		||||
    {
 | 
			
		||||
        [Fact]
 | 
			
		||||
        public void SelectTest()
 | 
			
		||||
        {
 | 
			
		||||
            IFreeSql fsql = g.sqlserver;
 | 
			
		||||
            fsql.Delete<ts521>().Where("1=1").ExecuteAffrows();
 | 
			
		||||
            fsql.Insert(new ts521 { ID = 1000000000000000001 }).ExecuteAffrows();
 | 
			
		||||
 | 
			
		||||
            var item = new List<ts521>();
 | 
			
		||||
            item.Add(new ts521 { ID = 1000000000000000001, SpellCode = "ces", Version = 1 });
 | 
			
		||||
 | 
			
		||||
            fsql.Update<ts521>().SetSource(item).UpdateColumns(info => info.SpellCode).ExecuteAffrows();
 | 
			
		||||
        }
 | 
			
		||||
        class ts521
 | 
			
		||||
        {
 | 
			
		||||
            [Key]
 | 
			
		||||
            public long ID { get; set; }
 | 
			
		||||
 | 
			
		||||
            [Description("名字")]
 | 
			
		||||
            public string Name { get; set; }
 | 
			
		||||
 | 
			
		||||
            [Description("账号")]
 | 
			
		||||
            [Column(IsNullable = false)]
 | 
			
		||||
            public string Account { get; set; }
 | 
			
		||||
 | 
			
		||||
            [Description("名称拼音首字母")]
 | 
			
		||||
            public string SpellCode { get; set; }
 | 
			
		||||
 | 
			
		||||
            [Description("乐观锁")]
 | 
			
		||||
            [Column(IsVersion = true, InsertValueSql = "1")]
 | 
			
		||||
            public long Version { get; set; }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user