1

I'm going to create a property for my Model which got minLength = 6 but no limit for its maximum.

Using below syntax, Visual Studio says there are no overloads for below syntax and I should put MaxmimumLength as first parameter. So are there any MAX_LENGTH constants or such thing to put as first parameter?

    [StringLength(MinimumLength = 6)]
    public string Name { get; set; }

1 Answer 1

3

Try this:

[StringLength(Int32.MaxValue, MinimumLength = 6)]
public string Name { get; set; }
Sign up to request clarification or add additional context in comments.

1 Comment

Will Int32.MaxValue map to nvarchar(MAX) when appled to code first migrations?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.