TargetSet Class

The TargetSet object represents a policy-based Management target set that holds information about levels, the condition for each level, and the target types.

System.Object
  Microsoft.SqlServer.Management.Sdk.Sfc.SfcInstance
    Microsoft.SqlServer.Management.Dmf.TargetSet

Namespace:  Microsoft.SqlServer.Management.Dmf
Assembly:  Microsoft.SqlServer.Dmf (in Microsoft.SqlServer.Dmf.dll)

[StrongNameIdentityPermissionAttribute(SecurityAction.LinkDemand, PublicKey = "0024000004800000940000000602000000240000525341310004000001000100272736ad6e5f9586bac2d531eabc3acc666c2f8ec879fa94f8f7b0327d2ff2ed523448f83c3d5c5dd2dfc7bc99c5286b2c125117bf5cbe242b9d41750732b2bdffe649c6efb8e5526d526fdd130095ecdb7bf210809c6cdad8824faa9ac0310ac3cba2aa0523567b2dfa7fe250b30facbd62d4ec99b94ac47c7d3b28f1f6e4c8")]
public sealed class TargetSet : SfcInstance

The TargetSet type exposes the following members.

  NameDescription
Public methodTargetSet()Initializes a new instance of the TargetSet class.
Public methodTargetSet(ObjectSet, String)Initializes a new instance of the TargetSet class on the specified connection.
Top

  NameDescription
Protected propertyAbstractIdentityKeyDo not reference this member directly in your code. It supports the SQL Server infrastructure. (Inherited from SfcInstance.)
Public propertyEnabledGets or sets the Boolean value that specifies whether the target set is enabled.
Public propertyIDGets the ID value that uniquely identifies the target set.
Public propertyIdentityKeyGets the key value that identifies the target set.
Public propertyLevelsRepresents a collection of TargetSetLevel objects. Each TargetSetLevel object represents a policy-based Management target set level.
Public propertyMetadataReturns metadata about the instance and its domain. (Inherited from SfcInstance.)
Public propertyParentGets the ObjectSet object that is the parent of the TargetSet object.
Public propertyPropertiesReturns a collection instance properties. (Inherited from SfcInstance.)
Protected propertyPropertyStorageProviderDo not reference this member directly in your code. It supports the SQL Server infrastructure. (Inherited from SfcInstance.)
Public propertyRootLevelGets the root level for the target set.
Protected propertyStateReturns the state of the SfcInstance object. (Inherited from SfcInstance.)
Public propertyTargetTypeGets the target type for the target set.
Public propertyTargetTypeSkeletonGets the target type skeleton for the target set.
Public propertyUrnReturns the uniform resource name of the SfcInstance object. (Inherited from SfcInstance.)
Top

  NameDescription
Protected methodAlterImplDo not reference this member directly in your code. It supports the SQL Server infrastructure. (Inherited from SfcInstance.)
Protected methodCheckObjectCreatedDo not reference this member directly in your code. It supports the SQL Server infrastructure. (Inherited from SfcInstance.)
Protected methodCheckObjectStateDo not reference this member directly in your code. It supports the SQL Server infrastructure. (Inherited from SfcInstance.)
Protected methodCreateIdentityKeyDo not reference this member directly in your code. It supports the SQL Server infrastructure. (Inherited from SfcInstance.)
Protected methodCreateImplDo not reference this member directly in your code. It supports the SQL Server infrastructure. (Inherited from SfcInstance.)
Public methodDiscoverDiscovers dependency relationships for the specified sink. (Overrides SfcInstance.Discover(ISfcDependencyDiscoveryObjectSink).)
Protected methodDropImplDo not reference this member directly in your code. It supports the SQL Server infrastructure. (Inherited from SfcInstance.)
Public methodEquals (Inherited from Object.)
Protected methodFinalize (Inherited from Object.)
Protected methodGetChildCollectionDo not reference this member directly in your code. It supports the SQL Server infrastructure. (Inherited from SfcInstance.)
Public methodGetDomainDo not reference this member directly in your code. It supports the SQL Server infrastructure. (Inherited from SfcInstance.)
Public methodGetFilterGets the filter that is associated with the target set.
Public methodGetHashCode (Inherited from Object.)
Public methodGetLevelGets the target set level for the specified skeleton.
Public methodGetLevelsSortedReturns a sorted list of levels for the target set.
Public methodStatic memberGetObjectFactoryReturns the object factory used to generate instances of the TargetSet object.
Public methodGetPropertySetReturns the set of properties for the SfcInstance object. (Inherited from SfcInstance.)
Public methodGetType (Inherited from Object.)
Protected methodGetTypeMetadataImplIndicates the domains that override by returning the right TypeMetadata class directly. Do not reference this member directly in your code. It supports the SQL Server infrastructure. (Inherited from SfcInstance.)
Protected methodInitializeUIPropertyStateDo not reference this member directly in your code. It supports the SQL Server infrastructure. (Inherited from SfcInstance.)
Protected methodMarkForDropImplReturns a value that indicates the existing objects to be dropped. Do not reference this member directly in your code. It supports the SQL Server infrastructure. (Inherited from SfcInstance.)
Protected methodMarkRootAsConnectedDo not reference this member directly in your code. It supports the SQL Server infrastructure. (Inherited from SfcInstance.)
Protected methodMemberwiseClone (Inherited from Object.)
Protected methodMoveImplIndicates the new parent object to move in an instance. Do not reference this member directly in your code. It supports the SQL Server infrastructure. (Inherited from SfcInstance.)
Protected methodOnPropertyMetadataChangesInvoked whenever the effective value of any SfcInstance metadata is updated. (Inherited from SfcInstance.)
Protected methodOnPropertyValueChangesInvoked whenever the effective value of any SfcInstance property is updated. (Inherited from SfcInstance.)
Protected methodPostAlterDo not reference this member directly in your code. It supports the SQL Server infrastructure. (Inherited from SfcInstance.)
Protected methodPostCreateIndicates the default implementor that creates the execution result. Do not reference this member directly in your code. It supports the SQL Server infrastructure. (Inherited from SfcInstance.)
Protected methodPostDropDo not reference this member directly in your code. It supports the SQL Server infrastructure. (Inherited from SfcInstance.)
Protected methodPostMoveDo not reference this member directly in your code. It supports the SQL Server infrastructure. (Inherited from SfcInstance.)
Protected methodPostRenameDo not reference this member directly in your code. It supports the SQL Server infrastructure. (Inherited from SfcInstance.)
Public methodRefreshRefreshes the object's properties by reading them from the server. (Inherited from SfcInstance.)
Protected methodRenameImplDo not reference this member directly in your code. It supports the SQL Server infrastructure. (Inherited from SfcInstance.)
Protected methodResetKeyDo not reference this member directly in your code. It supports the SQL Server infrastructure. (Inherited from SfcInstance.)
Public methodSerializeSerializes the instance to XML. (Inherited from SfcInstance.)
Public methodSetLevelConditionSets the condition for the specified target set level.
Public methodToStringReturns a string representation of the instance Urn. (Inherited from SfcInstance.)
Protected methodUpdateUIPropertyStateDo not reference this member directly in your code. It supports the SQL Server infrastructure. (Inherited from SfcInstance.)
Protected methodValidateIndicates the basic child object's validation. Do not reference this member directly in your code. It supports the SQL Server infrastructure. (Inherited from SfcInstance.)
Top

  NameDescription
Protected eventpropertyChangedDo not reference this member directly in your code. It supports the SQL Server infrastructure. (Inherited from SfcInstance.)
Public eventPropertyChangedCLS-compliant event for property changes. (Inherited from SfcInstance.)
Protected eventpropertyMetadataChangedDo not reference this member directly in your code. It supports the SQL Server infrastructure. (Inherited from SfcInstance.)
Public eventPropertyMetadataChangedCLS-compliant event for property metadata changes. (Inherited from SfcInstance.)
Top

A target object set is the resulting set of target object after applying a filter to SQL Server instance. Using a Filter object you can create a Urn object which you can use to create an XPath expression. The XPath expression can be used to specify a skeleton XPath expression which filters the target objects out of the object set.

C#

SFC.Urn urn = new SFC.Urn(filter);
SFC.XPathExpression xpe = urn.XPathExpression;

string ts_skeleton = urn.XPathExpression.ExpressionSkeleton;
ObjectSet os = new ObjectSet(p.Parent, p.Name + "ObjectSet");
os.Facet = p.Parent.Conditions[p.Condition].Facet;
TargetSet ts = os.TargetSets[ts_skeleton];
ts.Enabled = true;
for (int i = 1; i < xpe.Length; i++)
{
   if (null != xpe[i].Filter)
   {
      string skeleton = urn.XPathExpression.BlockExpressionSkeleton(i);
      TargetSetLevel cr = ts.GetLevel(skeleton);

      ExpressionNode expr = ExpressionNode.ConvertFromFilterNode(xpe[i].Filter);
      Condition c = ConditionObject.Create(p.Parent, cr.TargetType.Name, expr);
      ts.SetLevelCondition(cr, c.Name);
   }
}
os.Create();
p.ObjectSet = os.Name;

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Community Additions

ADD
Show: