- 增加 MaxLength 特性的解析,实体字符串长度设置;

This commit is contained in:
28810
2019-09-11 20:40:52 +08:00
parent 96bf97bb7f
commit bddcf9c0bc
5 changed files with 56 additions and 11 deletions

View File

@ -1,6 +1,7 @@
using FreeSql;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
public class UserGroup : BaseEntity<UserGroup, int>
{
@ -35,20 +36,24 @@ public class User1 : BaseEntity<User1, Guid>
/// <summary>
/// 登陆名
/// </summary>
[MaxLength(32)]
public string Username { get; set; }
/// <summary>
/// 昵称
/// </summary>
[MaxLength(64)]
public string Nickname { get; set; }
/// <summary>
/// 头像
/// </summary>
[MaxLength(1024)]
public string Avatar { get; set; }
/// <summary>
/// 描述
/// </summary>
[MaxLength(4000)]
public string Description { get; set; }
}

View File

@ -54,7 +54,7 @@ namespace orm_vs
{
testlist2.AddRange(list);
});
fsql.CodeFirst.SyncStructure(typeof(Song), typeof(Song_tag), typeof(Tag));
//sugar.CodeFirst.InitTables(typeof(Song), typeof(Song_tag), typeof(Tag));
//sugar创建表失败SqlSugar.SqlSugarException: Sequence contains no elements
@ -76,7 +76,7 @@ namespace orm_vs
Insert(sb, 1000, 10);
Console.Write(sb.ToString());
sb.Clear();
Insert(sb, 1, 1000);
Console.Write(sb.ToString());
sb.Clear();