IndexAnnotation Class

Definition

Instances of this class are used as custom annotations for representing database indexes in an Entity Framework model.

public class IndexAnnotation : System.Data.Entity.Infrastructure.Annotations.IMergeableAnnotation
type IndexAnnotation = class
    interface IMergeableAnnotation
Public Class IndexAnnotation
Implements IMergeableAnnotation
Inheritance
IndexAnnotation
Implements

Remarks

An index annotation is added to a Code First model when an IndexAttribute is placed on a mapped property of that model. This is used by Entity Framework Migrations to create indexes on mapped database columns. Note that multiple index attributes on a property will be merged into a single annotation for the column. Similarly, index attributes on multiple properties that map to the same column will be merged into a single annotation for the column. This means that one index annotation can represent multiple indexes. Within an annotation there can be only one index with any given name.

Constructors

IndexAnnotation(IEnumerable<IndexAttribute>)

Creates a new annotation for the given collection of indexes.

IndexAnnotation(IndexAttribute)

Creates a new annotation for the given index.

Fields

AnnotationName

The name used when this annotation is stored in Entity Framework metadata or serialized into an SSDL/EDMX file.

Properties

Indexes

Gets the indexes represented by this annotation.

Methods

IsCompatibleWith(Object)

Returns true if this annotation does not conflict with the given annotation such that the two can be combined together using the MergeWith(Object) method.

MergeWith(Object)

Merges this annotation with the given annotation and returns a new annotation containing the merged indexes.

ToString()

Returns a string that represents the current object.

Applies to