Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nvarchar(max) can't be used with indexed columns #1071

Closed
bricelam opened this issue Nov 17, 2014 · 3 comments
Closed

nvarchar(max) can't be used with indexed columns #1071

bricelam opened this issue Nov 17, 2014 · 3 comments
Labels
closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. type-bug
Milestone

Comments

@bricelam
Copy link
Contributor

(See How to create an index for a string property in Entity Framework 7)

Similar to how we use nvarchar(450) on key columns, we should do something similar for indexed columns. I assume this also applies to varbinary(max).

@bricelam bricelam changed the title nvarchar(max) can't be used with indecies nvarchar(max) can't be used with indexed columns Nov 17, 2014
@rowanmiller rowanmiller added this to the 1.0.0-rc1 milestone Nov 17, 2014
@rowanmiller rowanmiller modified the milestones: 7.0.0-rc1, 7.0.0 Nov 25, 2014
@Muchiachio
Copy link

Can a key/foreign key property length be lowered to 128? To follow EF6 of defaulting keys to 128? Or you have a reason to use string length of 450, which is quite big for the string key.

@ChristineBoersen
Copy link

A workaround for now is during the OnModelCreating event of your Context add the following to manually change the column length to 450 characters versus letting the CLR make them nvarchar(max), you will get an nvarchar(450).

Give that your POCO is named YOUROBJECTNAME and that your property is named YOURFIELDNAME and is defined as a string

        modelBuilder.Entity<YOUROBJECTNAME>(entity =>
        {
              entity.Property(e => e.YOURFIELDNAME).MaxLength(450);
        });

@rowanmiller
Copy link
Contributor

Clearing for triage as this was marked as pri1... but if we are going to do it, we should do it for RTM

@rowanmiller rowanmiller removed this from the 7.0.0 milestone Dec 8, 2015
@rowanmiller rowanmiller added this to the 7.0.0-rc2 milestone Dec 11, 2015
@ajcvickers ajcvickers removed this from the 1.0.0-rc2 milestone Oct 15, 2022
@ajcvickers ajcvickers added the closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. label Oct 15, 2022
@ajcvickers ajcvickers added this to the 1.0.0 milestone Oct 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. type-bug
Projects
None yet
Development

No branches or pull requests

7 participants