Jonathan Wood
Jonathan Wood

Reputation: 67335

Using MaxLength attribute to specify NVARCHAR(MAX)

Using code-first data annotations, is it possible to use the [MaxLength()] attribute to specify a string column should be NVARCHAR(MAX)?

It doesn't appear to support this.

Upvotes: 0

Views: 1571

Answers (2)

requiem
requiem

Reputation: 1

Try to write like this [MaxLength(-1)] ?,

Upvotes: 0

Matt B
Matt B

Reputation: 346

If you don't use the [MaxLength()] attribute at all on your property, it'll create a column as NVARCHAR(MAX) by default I believe

Upvotes: 1

Related Questions