EF 6.1 Unique Nullable Index

c# ef-code-first entity-framework sql-server

Question

You can create indexes in EF 6.1 using Code First by leveraging the attributes in your entities or the fluent API in a manner similar to:

 Property(x => x.PropertyName)
                .IsOptional()
                .HasMaxLength(450)
                .HasColumnAnnotation("Index",
                    new IndexAnnotation(new IndexAttribute("IX_IndexName") {IsUnique = true,  }));

What other word for scaffold is there?WHERE PropertyName IS NOT NULL similarly to how you would in the native SQL Server environment (see: https://stackoverflow.com/a/767702/52026)?

1
45
5/23/2017 12:18:05 PM

Popular Answer

ZZZ_tmp
51
3/1/2016 9:17:38 AM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow