Sdílet prostřednictvím


SfcKey Class

Definition

The SfcKey class is the base class for all nested Key classes which every SfcInstance-derived object must have. It implements equality and hashing but not comparison, since Keys are only required to know if they are equal or not.

Keys are meant to be immutable once constructed, hence a Key should not contain data which can change during the Key object's lifetime. Do not use field(s) as part of a Key which are not truly part of the identity the Key represents. We may enforce this by disallowing set() on the internal properties for the Key.

Any ordering or collation needs are addressed by implementing:

  1. IComparable on the SfcKey-derived class
  2. IComparer or IComparer<T> on the SfcCollection-derived collection class
public abstract class SfcKey : IEquatable<Microsoft.SqlServer.Management.Sdk.Sfc.SfcKey>
type SfcKey = class
    interface IEquatable<SfcKey>
Public MustInherit Class SfcKey
Implements IEquatable(Of SfcKey)
Inheritance
SfcKey
Derived
Implements

Constructors

SfcKey()

Properties

InstanceType

The Type of the instance class associated with this key class. Default impl is the way a nested key class would do it for compatiblity with existing models using that technique. This should be overriden in any key class which is not a nested class of the instance type.

Methods

Equals(Object)

Each Key must do proper value comparison of its data members. Do not rely solely on reference equality checking like object does.

Equals(SfcKey)
GetHashCode()

Each Key must provide a reasonable hash code for its data members. Internally, strings can use their default hash codes, and numeric values can be used directly or bit-shifted and truncated to int. Multiple hash codes for internal data can usually be XOR'd together to produce a decent result.

GetUrnFragment()

Each Key must implement how to produce a valid XPath-oriented identity string fragmentwhich is used to build complete and valid Urn from a SfcKeyChain of Key[].

ToString()

Each Key

Applies to