I wonder if this is even possible, and I can't seem to find an answer. I am using Entity Framework / C# for a database application. I want to ensure that my front-end entities automatically match their counterparts in SQL for attributes like "StringLength". So, inside SQL, in my tables, if I specify, for example, "nvarchar(50)", I want to make sure that the user doesn't type more than 50 characters. I don't want to have to code this each time, so I'm looking for a way to have the C# application read the StringLength property from SQL and then apply logic in the front-end. I can't seem to find a way of getting this information by entity type/DbContext from the SQL database itself.
I thought I'd struck gold with this thread here: How to get the maximum length of a string from an EDMX model in code? but this seems to read from the entity schema defined in the C# application, not SQL.
I have attached a .png of the info I am trying to get from SQL for clarification. Any advice would be appreciated: