title: EF 6.1 Unique Nullable Index
body: <p>In EF 6.1 using Code First you can create Indexes using Attributes in your Entities or using the fluent API along the lines of:</p>
  
  <pre><code> Property(x =&gt; x.PropertyName)
                  .IsOptional()
                  .HasMaxLength(450)
                  .HasColumnAnnotation("Index",
                      new IndexAnnotation(new IndexAttribute("IX_IndexName") {IsUnique = true,  }));
  </code></pre>
  
  <p>Is there any way to say scaffold <code>WHERE PropertyName IS NOT NULL</code> in the same way you would in SQL Server natively (see: <a href="https://stackoverflow.com/a/767702/52026">https://stackoverflow.com/a/767702/52026</a>)?</p>