PolicyStore Class

Definition

The PolicyStore object is the root object for the DMF hierarchy.

[System.ComponentModel.TypeConverter(typeof(Microsoft.SqlServer.Management.Sdk.Sfc.LocalizableTypeConverter))]
public sealed class PolicyStore : Microsoft.SqlServer.Management.Sdk.Sfc.SfcInstance, Microsoft.SqlServer.Management.Common.IAlterable, Microsoft.SqlServer.Management.Sdk.Sfc.ISfcAlterable, Microsoft.SqlServer.Management.Sdk.Sfc.ISfcDomain, Microsoft.SqlServer.Management.Sdk.Sfc.ISfcSerializableUpgrade, Microsoft.SqlServer.Management.Sdk.Sfc.ISfcValidate
[<System.ComponentModel.TypeConverter(typeof(Microsoft.SqlServer.Management.Sdk.Sfc.LocalizableTypeConverter))>]
type PolicyStore = class
    inherit SfcInstance
    interface ISfcAlterable
    interface IAlterable
    interface ISfcDomain
    interface ISfcDomainLite
    interface ISfcHasConnection
    interface ISfcSerializableUpgrade
    interface ISfcValidate
Public NotInheritable Class PolicyStore
Inherits SfcInstance
Implements IAlterable, ISfcAlterable, ISfcDomain, ISfcSerializableUpgrade, ISfcValidate
Inheritance
PolicyStore
Attributes
Implements

Constructors

PolicyStore()

Don't ever call this, or if you do remember to set SqlStoreConnection

PolicyStore(SfcConnection)

Properties

AbstractIdentityKey (Inherited from SfcInstance)
Conditions
Enabled
Facets

Return a Collection of FacetInfo.

HistoryRetentionInDays
IdentityKey
KeyChain

Returns the identity path of the object

(Inherited from SfcInstance)
LogOnSuccess
Metadata (Inherited from SfcInstance)
Name

The name of the server connected to

ObjectSets
Parent

Parent is not something that is kept local, it is implied from the keychain The concept of a parent is really about the hiearchy up and under the root if we only do this via parents then we will not be able to instantiate objects with only lightweight SfcKeyChain sets

Setting the parent is therefor a helper operation to set a keychain

(Inherited from SfcInstance)
Policies
PolicyCategories
PolicyCategorySubscriptions
Properties (Inherited from SfcInstance)
PropertyStorageProvider

This property returns the default implementation of SFC for ISfcPropertyStorageProvider interface, it can be overriden in the child classes to return another storage provider (i.e. flat properties list)

(Inherited from SfcInstance)
SqlStoreConnection
State (Inherited from SfcInstance)
Urn

Create a new Urn string on each request and return it.

(Inherited from SfcInstance)

Methods

Alter()
AlterImpl() (Inherited from SfcInstance)
CheckObjectCreated()

To be called from domain for when an API requires the object to be Created Stronger than CheckObjectState

(Inherited from SfcInstance)
CheckObjectState()

To be called from domain for any access to the object

(Inherited from SfcInstance)
CreateIdentityKey() (Inherited from SfcInstance)
CreateImpl() (Inherited from SfcInstance)
CreatePolicyFromFacet(Object, String, String, String, XmlWriter)

This method instantiates a Policy object which applies to the given target, and then add the policy to permanent storage. The policy is associated with a Condition whose ConditionExpression objects reflect the properties of the target as seen through the given facet at the time this method is called. You can access the newly created policy through this PolicyStore's Policies[policyName] collection.

CreatePolicyFromFacet(SfcQueryExpression, String, String, String)

This method instantiates a Policy object which applies to the given target, and then add the policy to permanent storage. The policy is associated with a Condition whose ConditionExpression objects reflect the properties of the target as seen through the given facet at the time this method is called. You can access the newly created policy through this PolicyStore's Policies[policyName] collection.

CreatePolicyFromFacet(SfcQueryExpression, String, String, String, XmlWriter)

This method instantiates a temporary Policy object and then serializes it through the given XmlWriter. The policy is associated with a Condition whose ConditionExpression objects reflect the properties of the target as seen through the given facet at the time this method is called. This PolicyStore object is not changed by this call.

DeserializePolicy(XmlReader, Boolean, Boolean)

Deserialize a single policy from the given XML reader. The reader should be previously created by a supported Export method. The deserialized Policy exists in-memory only and must be created in the PolicyStore on the server to persist it.

Discover(ISfcDependencyDiscoveryObjectSink)
DropImpl() (Inherited from SfcInstance)
EnumApplicablePolicies(SfcQueryExpression)

Returns a DataTable containing the policies that apply to the same target type as the supplied target. In other words, if a Database target is given then policies that apply to Database, Table and any other types under database will be considered.

EnumApplicablePolicyCategories(SfcQueryExpression)

Returns a read-only collection containing each policy category, repeated for each of the policies in that category, and a flag if the target subscribes to the category, all of the database and database descendent policies in the category, and the execution mode of the policy. Note: this method is currently only valid on database targets.

EnumConditionsOnFacet(String)

Enumerate Conditions associated with the given facet

EnumConditionsOnFacet(String, PolicyStore+EnumerationMode)

Enumerate Conditions associated with the given facet, honoring IsSystemObject flag

EnumDomainFacets(String[])

Return a Collection of FacetInfo for listed domains. Pass String.Empty for Facets, not associated with SFC Domain

EnumPoliciesOnFacet(String)

Enumerate Policies associated with the given facet

EnumPoliciesOnFacet(String, PolicyStore+EnumerationMode)

Enumerate Policies associated with the given facet, honoring IsSystemObject flag

EnumPolicyCategories()

Returns a read-only collection containing all of the policy categories.

EnumRootConditions(Type)

Enmerate root conditions for a given type

EnumRootFacets(Type)

Returns a collection of Root facets

EnumTargetSetConditions(Type)

Enumerate Conditions for a given Type that can be use in TargetSet filters

EnumTargetSetConditions(Type, PolicyStore+EnumerationMode)

Enumerate Conditions for a given Type that can be use in TargetSet filters, honoring IsSystemObject flag

EraseSystemHealthPhantomRecords()

This function erases the phantom records from the system health table by iterating through all the violations and verifying that they correspond to an existing object.

GetAggregatedHealthState(SfcQueryExpression)

Returns the aggregated health information of the target query, which can describe either a single object or a collection of objects.

GetChildCollection(String)

Get the child collection in this instance for the given element name string.

(Inherited from SfcInstance)
GetDomain() (Inherited from SfcInstance)
GetPropertySet() (Inherited from SfcInstance)
GetTypeMetadataImpl() (Inherited from SfcInstance)
ImportPolicy(XmlReader, ImportPolicyEnabledState, Boolean, Boolean)

Import a single policy from the given XML reader. The reader should be previously created by a supported Export method. The imported Policy is also created in the PolicyStore on the server.

InitializeUIPropertyState()

Overridable from the child objects who care about initializing their states (dynamic metadata which is currently the ".Enabled" property)

(Inherited from SfcInstance)
MarkForDropImpl(Boolean) (Inherited from SfcInstance)
MarkRootAsConnected() (Inherited from SfcInstance)
MarkSystemObject(Object, Boolean)

Sets System flag on objects in the store

MoveImpl(SfcInstance) (Inherited from SfcInstance)
OnPropertyMetadataChanges(SfcPropertyMetadataChangedEventArgs) (Inherited from SfcInstance)
OnPropertyValueChanges(PropertyChangedEventArgs) (Inherited from SfcInstance)
PostAlter(Object) (Inherited from SfcInstance)
PostCreate(Object) (Inherited from SfcInstance)
PostDrop(Object) (Inherited from SfcInstance)
PostMove(Object) (Inherited from SfcInstance)
PostRename(Object) (Inherited from SfcInstance)
PurgeHealthState()

Purge all records from the policy health state table.

PurgeHealthState(SfcQueryExpression)

Purge records from the policy health state table that are associated with the nodes in the tree, starting with the value that is passed to targetTreeRoot.

Refresh()

refreshes the object's properties by reading them from the server

(Inherited from SfcInstance)
RenameImpl(SfcKey) (Inherited from SfcInstance)
RepairPolicyAutomation()

Restores all artifacts that have been created by policy-based management to support policy automation.

ResetKey() (Inherited from SfcInstance)
ScriptAlter()
Serialize(XmlWriter) (Inherited from SfcInstance)
StartSerializationUpgrade()
SubscribeToPolicyCategory(SfcQueryExpression, String)

Creates a subscription for the provided target to the specified policy category. This will throw if the subscription already exists.

ToString()

The string identity of a policy store is the associated Server name.

UnsubscribeFromPolicyCategory(SfcQueryExpression, String)

Unsubscribe the provided target from the specified policy category. This will throw if the target does not subscribe to the category.

UpdateUIPropertyState() (Inherited from SfcInstance)
Validate()

Basic child object's validation

(Inherited from SfcInstance)

Events

propertyChanged (Inherited from SfcInstance)
PropertyChanged (Inherited from SfcInstance)
propertyMetadataChanged (Inherited from SfcInstance)
PropertyMetadataChanged (Inherited from SfcInstance)

Explicit Interface Implementations

ISfcDomain.GetExecutionEngine()
ISfcDomain.GetKey(IUrnFragment)

returns the Key object given Urn fragment

ISfcDomain.GetType(String)
ISfcDomain.GetTypeMetadata(String)
ISfcDomain.UseSfcStateManagement()
ISfcDomainLite.DomainInstanceName
ISfcDomainLite.DomainName
ISfcDomainLite.GetLogicalVersion()

Returns the logical version of the domain

ISfcHasConnection.ConnectionContext
ISfcHasConnection.GetConnection()

Get the current connection to query on. Return a connection supporting a single serial query, so the query must end before another one may begin.

ISfcHasConnection.GetConnection(SfcObjectQueryMode)

Get the current connection to query on. Return a connection supporting either a single serial query or multiple simultaneously open queries as requested.

ISfcHasConnection.SetConnection(ISfcConnection)

Sets the active connection.

ISfcValidate.Validate(String, Object[])

ISfcValidate implementation for Policy

Applies to