Linq to SQL-基础列长度 [英] Linq to SQL - Underlying Column Length
问题描述
我已经使用Linq to SQL已有一段时间了,我发现它非常有用并且易于使用.使用我过去使用的其他ORM工具,从数据库填充的实体对象通常具有指示数据库中基础数据列长度的属性.这在数据绑定情况下很有用,在这种情况下,您可以在文本框上设置MaxLength属性,例如,限制用户输入的输入长度.
I've been using Linq to SQL for some time now and I find it to be really helpful and easy to use. With other ORM tools I've used in the past, the entity object filled from the database normally has a property indicating the length of the underlying data column in the database. This is helpful in databinding situations where you can set the MaxLength property on a textbox, for example, to limit the length of input entered by the user.
我找不到使用Linq to SQL来获取基础数据列的长度的方法.有人知道这样做的方法吗?请帮助.
I cannot find a way using Linq to SQL to obtain the length of an underlying data column. Does anyone know of a way to do this? Help please.
推荐答案
使用LINQ ColumnAttribute从数据库中获取字段长度:
Using the LINQ ColumnAttribute to Get Field Lengths from your Database :
http://www.codeproject.com/KB/cs/LinqColumnAttributeTricks.aspx
这篇关于Linq to SQL-基础列长度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!