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

[Unique] Data annotation #8266

Closed
bugproof opened this issue Apr 24, 2017 · 1 comment
Closed

[Unique] Data annotation #8266

bugproof opened this issue Apr 24, 2017 · 1 comment

Comments

@bugproof
Copy link

Currently, it's possible to ensure field uniqueness like this:

protected override void OnModelCreating(ModelBuilder modelBuilder)
{
    modelBuilder.Entity<Model>()
        .HasIndex(m => m.Field)
        .IsUnique();
}

I'm not sure about other ways.

My proposition is to add [Unique] data annotation to simplify this process.

@lajones
Copy link
Contributor

lajones commented Apr 24, 2017

@midnightstarr There has been a suggestion for an Index attribute in the past. I think Unique would be part of that. So closing as a dupe of #4050.

@lajones lajones closed this as completed Apr 24, 2017
@ajcvickers ajcvickers reopened this Oct 16, 2022
@ajcvickers ajcvickers closed this as not planned Won't fix, can't repro, duplicate, stale Oct 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants