src/Shared/EntityFramework/Infrastructure/Annotations/IndexAnnotation.cs
/// <summary>
/// Returns true if this annotation does not conflict with the given annotation such that
/// the two can be combined together using the <see cref="MergeWith"/> method.
/// </summary>
/// <remarks>
/// Each index annotation contains at most one <see cref="IndexAttribute"/> with a given name.
/// Two annotations are considered compatible if each IndexAttribute with a given name is only
/// contained in one annotation or the other, or if both annotations contain an IndexAttribute
/// with the given name.
/// </remarks>
/// <param name="other">The annotation to compare.</param>
/// <returns>A CompatibilityResult indicating whether or not this annotation is compatible with the other.</returns>
Returns true if this annotation does not conflict with the given annotation such that
the two can be combined together using the  method.
Returns true if this annotation does not conflict with the given annotation such that the two can be combined together using the method .
public virtual CompatibilityResult IsCompatibleWith(object other)
        {
            if (ReferenceEquals(this, other)
                || other == null)
            {
                return new CompatibilityResult(true, null);
            }
            var otherAnnotation = other as IndexAnnotation;
            if (otherAnnotation == null)
            {
                return new CompatibilityResult(false, Strings.IncompatibleTypes(other.GetType().Name, typeof(IndexAnnotation).Name));
            }
            foreach (var newIndex in otherAnnotation._indexes)
            {
                var existing = _indexes.SingleOrDefault(i => i.Name == newIndex.Name);
                if (existing != null)
                {
                    var isCompatible = existing.IsCompatibleWith(newIndex);
                    if (!isCompatible)
                    {
                        return isCompatible;
                    }
                }
            }
            return new CompatibilityResult(true, null);
        }
public virtual CompatibilityResult IsCompatibleWith ( object other ) { if ( ReferenceEquals ( this , other ) || other == null ) { return new CompatibilityResult ( true , null ) ; } var otherAnnotation = other as IndexAnnotation ; if ( otherAnnotation == null ) { return new CompatibilityResult ( false , Strings . IncompatibleTypes ( other . GetType ( ) . Name , typeof ( IndexAnnotation ) . Name ) ) ; } foreach ( var newIndex in otherAnnotation . _indexes ) { var existing = _indexes . SingleOrDefault ( i => i . Name == newIndex . Name ) ; if ( existing != null ) { var isCompatible = existing . IsCompatibleWith ( newIndex ) ; if ( ! isCompatible ) { return isCompatible ; } } } return new CompatibilityResult ( true , null ) ; }
Returns true if this annotation does not conflict with the given annotation such that
the two can be combined together using the  method.
Returns true if this annotation does not conflict with the given annotation such that the two can be combined together using the method .
A CompatibilityResult indicating whether or not this annotation is compatible with the other.
A CompatibilityResult indicating whether or not this annotation is compatible with the other .
other
object
The annotation to compare.
The annotation to compare .
remarks
Each index annotation contains at most one  with a given name.
Two annotations are considered compatible if each IndexAttribute with a given name is only
contained in one annotation or the other, or if both annotations contain an IndexAttribute
with the given name.
Each index annotation contains at most one with a given name . Two annotations are considered compatible if each IndexAttribute with a given name is only contained in one annotation or the other or if both annotations contain an IndexAttribute with the given name .