Partilhar via


SfcKeyChain Class

Definition

A SfcKeyChain is a domain root and a key list which is a full identity path to an Sfc instance object. The domain root determines which domain and instance it represents. The list of SfcAbstractKeys determines what domain type instance objects at each level it represents. They can be compared for equality and used as unique dictionary keys even when mixed domains are present.

public sealed class SfcKeyChain : IEquatable<Microsoft.SqlServer.Management.Sdk.Sfc.SfcKeyChain>
type SfcKeyChain = class
    interface IEquatable<SfcKeyChain>
Public NotInheritable Class SfcKeyChain
Implements IEquatable(Of SfcKeyChain)
Inheritance
SfcKeyChain
Implements

Constructors

SfcKeyChain(Urn, ISfcDomain)

The constructor to be used for creating SfcKeyChains when the fully qualified URN is known. This is used when a fully qualified URN is known but we do not have an object yet

Properties

Domain

Return the domain interface for given KeyChain

IsConnected
IsRooted
LeafKey

Get the key of the leaf node An SfcKeyChain is immutable so you must construct a new one to change the leaf key.

Parent

Get the SfcKeyChain for the parent of this one. An SfcKeyChain is immutable so you must construct a new one to change the parent.

RootKey

Get the key of the root node

Urn

A SfcKeyChain can always be converted into the equivalent Urn format.

Methods

ClientEquals(SfcKeyChain)

Compares for client equality of the same instance object in the same object tree.

Equals(Object)

Two SfcKeyChains are equal iff

  1. They are both from the same domain and domain instance tree
  2. They have the same number of Keys
  3. Each Key is equal, checked from the bottom up to avoid nearby-but-not-equal comparisons Each Key class must implement a reasonable operator== that compares the Key values and not rely on the default object.Equals(object) which only checks for reference equality.
Equals(SfcKeyChain)

The strongly-typed equality check used by the strongly-typed operators. Compares for client equality of the same instance in the same object tree.

GetHashCode()

The hash code for a SfcKeyChain is simply a XOR of all its component Key hash codes. Each Key class must implement a reasonable GetHashCode() for this to distribute itself well.

GetObject()

Get the Sfc object associated with this SfcKeyChain. This will look the object up in the hierarchy starting from the root of this key chain, and create new one (with putting it into collection) on demand. This is important so we never get orphaned objects

IsClientAncestorOf(SfcKeyChain)

Check if the given keychain is inside this one, using the rules of ClientEquality(). Inside is defined as comparing as equal from the top-down until the shorter (containing) keychain is exhausted. Note that comparing as equivalent, or either being null means not inside.

IsServerAncestorOf(SfcKeyChain)

Check if the given keychain is inside this one, using the rules of ServerEquality(). Inside is defined as comparing as equal from the top-down until the shorter (containing) keychain is exhausted. Note that comparing as equivalent, or either being null means not inside.

ServerEquals(SfcKeyChain)

Compares for server equivalence of the same logical server-side entity regardless of client-side object tree.

ToString()

The ToString() implementation should return a string representation usable in sorting by an external comparer. It should not respresent an XPath or any other format, unless intended as an actual collation format. TODO: Either add a GetComparerString() virtual, or make Keys do comprisons using an externally-provided Comparer.

Operators

Equality(SfcKeyChain, SfcKeyChain)

The == operator compares two SfcKeyChains.

  1. If both are null valued, they are equal.
  2. If both are to the same object reference, they are equal.
  3. If one is null but not the other, they are not equal.
  4. If the number of key level in the two SfcKeyChains are not the same, they are not equal.
  5. If the contents of each key level in both SfcKeyChains does not compare as equal, they are not equal. If it passes all of these tests, they are considered equal.
Inequality(SfcKeyChain, SfcKeyChain)

The != operator compares two SfcKeyChains for inequality by using the == operator and negating the result. See the == operator on the SfcKeyChain class for details on equality checking.

Applies to