现在应该支持了
@sunkaixuan 不报错了,但是容我再杠一下
插入不了MaxValue,发现创ushort这些字段的时候没有将字段标记为Unsigned
手动改了Unsigned后可以插入记录了,将记录读回出来的时候会出现Uint不能转为int
namespace OrmTest
{
public class DemoE_CodeFirst
{
public static void Init()
{
Console.WriteLine("");
Console.WriteLine("#### CodeFirst Start ####");
SqlSugarClient db = new SqlSugarClient(new ConnectionConfig()
{
DbType = DbType.MySql,
ConnectionString = Config.ConnectionString3,
InitKeyType = InitKeyType.Attribute,
IsAutoCloseConnection = true
});
db.DbMaintenance.CreateDatabase();
db.CodeFirst.InitTables(typeof(CodeFirstTable1));//Create CodeFirstTable1
db.Insertable(new CodeFirstTable1() { Name = "a", Text="a" , TestUInt64 = ulong.MaxValue, TestUInt32 = uint.MaxValue, TestUInt16 = ushort.MaxValue }).ExecuteCommand();
var list = db.Queryable().ToList();
Console.WriteLine("#### CodeFirst end ####");
}
}
public class CodeFirstTable1
{
[SugarColumn(IsIdentity = true, IsPrimaryKey = true)]
public int Id { get; set; }
public string Name { get; set; }
[SugarColumn(ColumnDataType = "Nvarchar(255)")]//custom
public string Text { get; set; }
[SugarColumn(IsNullable = true)]
public DateTime CreateTime { get; set; }
public ulong TestUInt64 { get; set; }
public uint TestUInt32 { get; set; }
public ushort TestUInt16 { get; set; }
}
}