I have a SQL Server table Workers and it has a column Name which is of datatype nvarchar(20).
I am using an ADO.NET Entity Data Model.
In my project, I want to limit user input to 20 characters (limit of my Name column).
How can I get this data through C# code and use it?
EDIT
The solution I need is a C# code that gives me the 20(limit of my Name column) so I can dynamically use it as a validation data. By that, If I change this limit on my database it will automatically use the updated data so I won't go to my input and manually change it for new limit.
My table will be a c# class by EntityFramework so I will have a class named
Workers and Name as a property of it. I am looking for the limit of this property.
All this information is stored in the SQL Server system catalog views in the
sysschema.You can e.g. get the max length of a particular column like this: