public static bool CanSetHasOperators( [NotNull] this IConventionIndexBuilder indexBuilder, [CanBeNull] IReadOnlyList <string> operators, bool fromDataAnnotation) => CanSetOperators(indexBuilder, operators, fromDataAnnotation);
public OnIndexUniquenessChangedNode(IConventionIndexBuilder indexBuilder) { IndexBuilder = 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 IConventionIndexBuilder OnIndexAdded([NotNull] IConventionIndexBuilder indexBuilder) => _scope.OnIndexAdded(indexBuilder);
public static bool CanSetFilter( [NotNull] this IConventionIndexBuilder indexBuilder, [CanBeNull] string?sql, bool fromDataAnnotation = false) => indexBuilder.CanSetAnnotation(RelationalAnnotationNames.Filter, sql, fromDataAnnotation);
public override bool?OnIndexUniquenessChanged(IConventionIndexBuilder indexBuilder) { Add(new OnIndexUniquenessChangedNode(indexBuilder)); return(indexBuilder.Metadata.IsUnique); }
public static bool CanSetInclude( this IConventionIndexBuilder indexBuilder, IReadOnlyList <string>?propertyNames, bool fromDataAnnotation = false) => CanSetIncludeProperties(indexBuilder, propertyNames, fromDataAnnotation);
public static bool CanSetDatabaseName( [NotNull] this IConventionIndexBuilder indexBuilder, [CanBeNull] string?name, bool fromDataAnnotation = false) => indexBuilder.CanSetAnnotation(RelationalAnnotationNames.Name, name, fromDataAnnotation);
public abstract IConventionAnnotation?OnIndexAnnotationChanged( IConventionIndexBuilder indexBuilder, string name, IConventionAnnotation?annotation, IConventionAnnotation?oldAnnotation);
public abstract IConventionIndexBuilder?OnIndexAdded([NotNull] IConventionIndexBuilder indexBuilder);
public abstract IReadOnlyList <bool>?OnIndexSortOrderChanged(IConventionIndexBuilder indexBuilder);
public abstract IConventionIndexBuilder?OnIndexAdded(IConventionIndexBuilder indexBuilder);
private void CheckIndexAttributesAndEnsureIndex( IConventionEntityType entityType, bool shouldThrow) { if (entityType.ClrType == null) { return; } foreach (var indexAttribute in entityType.ClrType.GetCustomAttributes <IndexAttribute>(true)) { IConventionIndexBuilder indexBuilder = null; if (!shouldThrow) { var indexProperties = new List <IConventionProperty>(); foreach (var propertyName in indexAttribute.PropertyNames) { var property = entityType.FindProperty(propertyName); if (property == null) { return; } indexProperties.Add(property); } indexBuilder = indexAttribute.Name == null ? entityType.Builder.HasIndex( indexProperties, fromDataAnnotation : true) : entityType.Builder.HasIndex( indexProperties, indexAttribute.Name, fromDataAnnotation: true); } else { try { // Using the HasIndex(propertyNames) overload gives us // a chance to create a missing property // e.g. if the CLR property existed but was non-public. indexBuilder = indexAttribute.Name == null ? entityType.Builder.HasIndex( indexAttribute.PropertyNames, fromDataAnnotation : true) : entityType.Builder.HasIndex( indexAttribute.PropertyNames, indexAttribute.Name, fromDataAnnotation: true); } catch (InvalidOperationException exception) { CheckMissingProperties(indexAttribute, entityType, exception); throw; } } if (indexBuilder == null) { CheckIgnoredProperties(indexAttribute, entityType); } else { var shouldBeUnique = indexAttribute.GetIsUnique(); if (shouldBeUnique.HasValue) { indexBuilder.IsUnique(shouldBeUnique.Value, fromDataAnnotation: true); } } } }
public override IConventionIndexBuilder OnIndexUniquenessChanged(IConventionIndexBuilder indexBuilder) { Add(new OnIndexUniquenessChangedNode(indexBuilder)); return(indexBuilder); }
public static bool CanSetHasSortOrder( [NotNull] this IConventionIndexBuilder indexBuilder, [CanBeNull] IReadOnlyList <SortOrder> values, bool fromDataAnnotation) => CanSetSortOrder(indexBuilder, values, fromDataAnnotation);
public static bool CanSetToTsVector( this IConventionIndexBuilder indexBuilder, string?config, bool fromDataAnnotation = false) => CanSetIsTsVectorExpressionIndex(indexBuilder, config, fromDataAnnotation);
public abstract IConventionAnnotation?OnIndexAnnotationChanged( [NotNull] IConventionIndexBuilder indexBuilder, [NotNull] string name, [CanBeNull] IConventionAnnotation?annotation, [CanBeNull] IConventionAnnotation?oldAnnotation);
public static bool CanSetHasNullSortOrder( this IConventionIndexBuilder indexBuilder, IReadOnlyList <NullSortOrder>?values, bool fromDataAnnotation) => CanSetNullSortOrder(indexBuilder, values, fromDataAnnotation);
public abstract bool?OnIndexUniquenessChanged([NotNull] IConventionIndexBuilder indexBuilder);
public static IConventionIndexBuilder?HasName( [NotNull] this IConventionIndexBuilder indexBuilder, [CanBeNull] string?name, bool fromDataAnnotation = false) => indexBuilder.HasDatabaseName(name, fromDataAnnotation);
/// <summary> /// Called after the uniqueness for an index is changed. /// </summary> /// <param name="indexBuilder">The builder for the index.</param> /// <param name="context">Additional information associated with convention execution.</param> public virtual void ProcessIndexUniquenessChanged( IConventionIndexBuilder indexBuilder, IConventionContext <bool?> context) => SetIndexFilter(indexBuilder);
public static bool CanSetName( [NotNull] this IConventionIndexBuilder indexBuilder, [CanBeNull] string?name, bool fromDataAnnotation = false) => CanSetDatabaseName(indexBuilder, name, fromDataAnnotation);
/// <summary> /// Called after an index is added to the entity type. /// </summary> /// <param name="indexBuilder">The builder for the index.</param> /// <param name="context">Additional information associated with convention execution.</param> public virtual void ProcessIndexAdded( IConventionIndexBuilder indexBuilder, IConventionContext <IConventionIndexBuilder> context) => SetIndexFilter(indexBuilder);
public override IConventionIndexBuilder OnIndexAdded(IConventionIndexBuilder indexBuilder) { Add(new OnIndexAddedNode(indexBuilder)); return(indexBuilder); }
public static bool CanSetHasCollation( this IConventionIndexBuilder indexBuilder, IReadOnlyList <string>?values, bool fromDataAnnotation) => CanSetCollation(indexBuilder, values, fromDataAnnotation);
public OnIndexAddedNode(IConventionIndexBuilder indexBuilder) { IndexBuilder = indexBuilder; }
public static bool CanSetHasMethod( this IConventionIndexBuilder indexBuilder, string?method, bool fromDataAnnotation = false) => CanSetMethod(indexBuilder, method, fromDataAnnotation);
public void ProcessIndexAdded( IConventionIndexBuilder indexBuilder, IConventionContext <IConventionIndexBuilder> context) => indexBuilder.HasName(RewriteName(indexBuilder.Metadata.GetName()));
public static bool CanSetHasOperators( this IConventionIndexBuilder indexBuilder, IReadOnlyList <string>?operators, bool fromDataAnnotation) => CanSetOperators(indexBuilder, operators, fromDataAnnotation);
/// <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 IConventionIndexBuilder OnIndexUniquenessChanged([NotNull] IConventionIndexBuilder indexBuilder) => _scope.OnIndexUniquenessChanged(indexBuilder);
public static bool CanSetHasMethod( [NotNull] this IConventionIndexBuilder indexBuilder, [CanBeNull] string method, bool fromDataAnnotation = false) => CanSetMethod(indexBuilder, method, fromDataAnnotation);