示例#1
0
        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.MySql().IsClustered != true &&
                index.Properties
                .Any(property => property.IsColumnNullable()))
            {
                if (columnNameChanged ||
                    index.MySql().Filter == null)
                {
                    indexBuilder.MySql(ConfigurationSource.Convention).HasFilter(CreateIndexFilter(index));
                }
            }
            else
            {
                if (index.MySql().Filter != null)
                {
                    indexBuilder.MySql(ConfigurationSource.Convention).HasFilter(null);
                }
            }

            return(indexBuilder);
        }
        /// <summary>
        ///     This API supports the Entity Framework Core infrastructure and is not intended to be used
        ///     directly from your code. This API may change or be removed in future releases.
        /// </summary>
        public virtual InternalIndexBuilder Apply(InternalIndexBuilder indexBuilder)
        {
            if (indexBuilder.Metadata.DeclaringEntityType.GetAllBaseTypesInclusive().Any(et => et.MySql().IsMemoryOptimized))
            {
                indexBuilder.MySql(ConfigurationSource.Convention).IsClustered(false);
            }

            return(indexBuilder);
        }