EF中限制字段显示长度

  在EF中有些添加的字段 文本显示超多文字,想截取显示又没有截取功能。

怎么办?

  我们可以在EF中类的属性中设置

你想限制这个用户名只能有10个字符长度
public String UserName
{
        get{return username;}
        set{if(value.Length<=10){username=value;}}
}
转载 请注明原文地址并标明转载:http://www.cnblogs.com/laopo 商业用途请与我联系:lcfhn168@163.com
原文地址:https://www.cnblogs.com/laopo/p/4780168.html