Search for existing suggestions

Required / MinLength should not allow empty strings

To my knowledge, the RequiredAttribute data annotation for string types only results in the corresponding database table column being created as NOT NULL.

I believe this is not sufficient. Moreover, it is in conflict with user interface layers, like MVC, which cannot reliably discern between an input being null or an empty string.

So I'd like to suggest to amend the behaviour of the RequiredAttribute so that it will additionally create the following T-SQL CHECK constraint: CHECK (LEN(LTRIM(RTRIM( {columnName} ))) > 0).

See here for full discussion:

https://entityframework.codeplex.com/discussions/572641

2 votes
Sign in
(thinking…)
Sign in with: facebook google
Signed in as (Sign out)

We’ll send you updates on this idea

AxelD shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

0 comments

Sign in
(thinking…)
Sign in with: facebook google
Signed in as (Sign out)
Submitting...

Feedback and Knowledge Base