private InternalIndexBuilder SetIndexFilter(InternalIndexBuilder indexBuilder, bool columnNameChanged = false) { // TODO: compare with a cached filter to avoid overriding if it was set by a different convention var index = indexBuilder.Metadata; if (index.IsUnique && index.SqlServer().IsClustered != true && index.Properties .Any(property => property.IsColumnNullable())) { if (columnNameChanged || index.SqlServer().Filter == null) { indexBuilder.SqlServer(ConfigurationSource.Convention).HasFilter(CreateIndexFilter(index)); } } else { if (index.SqlServer().Filter != null) { indexBuilder.SqlServer(ConfigurationSource.Convention).HasFilter(null); } } return(indexBuilder); }
/// <summary> /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to /// the same compatibility standards as public APIs. It may be changed or removed without notice in /// any release. You should only use it directly in your code with extreme caution and knowing that /// doing so can result in application failures when updating to a new Entity Framework Core release. /// </summary> public virtual InternalIndexBuilder Apply(InternalIndexBuilder indexBuilder) { if (indexBuilder.Metadata.DeclaringEntityType.GetAllBaseTypesInclusive().Any(et => et.SqlServer().IsMemoryOptimized)) { indexBuilder.SqlServer(ConfigurationSource.Convention).IsClustered(false); } return(indexBuilder); }