PolicyStore PolicyStore 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
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
PolicyStorePolicyStorePolicyStore
Attributes
Implements

Constructors

PolicyStore() PolicyStore() PolicyStore()

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

PolicyStore(SfcConnection) PolicyStore(SfcConnection) PolicyStore(SfcConnection)

Properties

AbstractIdentityKey AbstractIdentityKey AbstractIdentityKey Inherited from SfcInstance
Conditions Conditions Conditions
Enabled Enabled Enabled
Facets Facets Facets

Return a Collection of FacetInfo.

HistoryRetentionInDays HistoryRetentionInDays HistoryRetentionInDays
IdentityKey IdentityKey IdentityKey
LogOnSuccess LogOnSuccess LogOnSuccess
Metadata Metadata Metadata Inherited from SfcInstance
Name Name Name

The name of the server connected to

ObjectSets ObjectSets ObjectSets
Parent Parent 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 Policies Policies
PolicyCategories PolicyCategories PolicyCategories
PolicyCategorySubscriptions PolicyCategorySubscriptions PolicyCategorySubscriptions
Properties Properties Properties Inherited from SfcInstance
PropertyStorageProvider PropertyStorageProvider 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 SqlStoreConnection SqlStoreConnection
State State State Inherited from SfcInstance
Urn Urn Urn

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

(Inherited from SfcInstance)

Methods

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

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

(Inherited from SfcInstance)
CheckObjectState() CheckObjectState() CheckObjectState()

To be called from domain for any access to the object

(Inherited from SfcInstance)
CreateIdentityKey() CreateIdentityKey() CreateIdentityKey() Inherited from SfcInstance
CreateImpl() CreateImpl() CreateImpl() Inherited from SfcInstance
CreatePolicyFromFacet(Object, String, String, String, XmlWriter) CreatePolicyFromFacet(Object, String, String, String, XmlWriter) 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) CreatePolicyFromFacet(SfcQueryExpression, String, String, String) 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) CreatePolicyFromFacet(SfcQueryExpression, String, String, String, XmlWriter) 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) DeserializePolicy(XmlReader, Boolean, Boolean) 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) Discover(ISfcDependencyDiscoveryObjectSink) Discover(ISfcDependencyDiscoveryObjectSink)
DropImpl() DropImpl() DropImpl() Inherited from SfcInstance
EnumApplicablePolicies(SfcQueryExpression) EnumApplicablePolicies(SfcQueryExpression) 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) EnumApplicablePolicyCategories(SfcQueryExpression) 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) EnumConditionsOnFacet(String) EnumConditionsOnFacet(String)

Enumerate Conditions associated with the given facet

EnumConditionsOnFacet(String, PolicyStore+EnumerationMode) EnumConditionsOnFacet(String, PolicyStore+EnumerationMode) EnumConditionsOnFacet(String, PolicyStore+EnumerationMode)

Enumerate Conditions associated with the given facet, honoring IsSystemObject flag

EnumDomainFacets(String[]) EnumDomainFacets(String[]) EnumDomainFacets(String[])

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

EnumPoliciesOnFacet(String) EnumPoliciesOnFacet(String) EnumPoliciesOnFacet(String)

Enumerate Policies associated with the given facet

EnumPoliciesOnFacet(String, PolicyStore+EnumerationMode) EnumPoliciesOnFacet(String, PolicyStore+EnumerationMode) EnumPoliciesOnFacet(String, PolicyStore+EnumerationMode)

Enumerate Policies associated with the given facet, honoring IsSystemObject flag

EnumPolicyCategories() EnumPolicyCategories() EnumPolicyCategories()

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

EnumRootConditions(Type) EnumRootConditions(Type) EnumRootConditions(Type)

Enmerate root conditions for a given type

EnumRootFacets(Type) EnumRootFacets(Type) EnumRootFacets(Type)

Returns a collection of Root facets

EnumTargetSetConditions(Type) EnumTargetSetConditions(Type) EnumTargetSetConditions(Type)

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

EnumTargetSetConditions(Type, PolicyStore+EnumerationMode) EnumTargetSetConditions(Type, PolicyStore+EnumerationMode) EnumTargetSetConditions(Type, PolicyStore+EnumerationMode)

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

EraseSystemHealthPhantomRecords() EraseSystemHealthPhantomRecords() 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) GetAggregatedHealthState(SfcQueryExpression) 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) GetChildCollection(String) GetChildCollection(String)

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

(Inherited from SfcInstance)
GetDomain() GetDomain() GetDomain() Inherited from SfcInstance
GetPropertySet() GetPropertySet() GetPropertySet() Inherited from SfcInstance
GetTypeMetadataImpl() GetTypeMetadataImpl() GetTypeMetadataImpl() Inherited from SfcInstance
ImportPolicy(XmlReader, ImportPolicyEnabledState, Boolean, Boolean) ImportPolicy(XmlReader, ImportPolicyEnabledState, Boolean, Boolean) 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() InitializeUIPropertyState() 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) MarkForDropImpl(Boolean) MarkForDropImpl(Boolean) Inherited from SfcInstance
MarkRootAsConnected() MarkRootAsConnected() MarkRootAsConnected() Inherited from SfcInstance
MarkSystemObject(Object, Boolean) MarkSystemObject(Object, Boolean) MarkSystemObject(Object, Boolean)

Sets System flag on objects in the store

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

Purge all records from the policy health state table.

PurgeHealthState(SfcQueryExpression) PurgeHealthState(SfcQueryExpression) 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() Refresh() Refresh()

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

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

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

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

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

ToString() ToString() ToString()

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

UnsubscribeFromPolicyCategory(SfcQueryExpression, String) UnsubscribeFromPolicyCategory(SfcQueryExpression, String) 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() UpdateUIPropertyState() UpdateUIPropertyState() Inherited from SfcInstance
Validate() Validate() Validate()

Basic child object's validation

(Inherited from SfcInstance)

Explicit Interface Implementations

ISfcDomain.GetExecutionEngine() ISfcDomain.GetExecutionEngine() ISfcDomain.GetExecutionEngine()
ISfcDomain.GetKey(IUrnFragment) ISfcDomain.GetKey(IUrnFragment) ISfcDomain.GetKey(IUrnFragment)

returns the Key object given Urn fragment

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

Returns the logical version of the domain

ISfcHasConnection.ConnectionContext ISfcHasConnection.ConnectionContext ISfcHasConnection.ConnectionContext
ISfcHasConnection.GetConnection() ISfcHasConnection.GetConnection() 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) ISfcHasConnection.GetConnection(SfcObjectQueryMode) 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) ISfcHasConnection.SetConnection(ISfcConnection) ISfcHasConnection.SetConnection(ISfcConnection)

Sets the active connection.

ISfcValidate.Validate(String, Object[]) ISfcValidate.Validate(String, Object[]) ISfcValidate.Validate(String, Object[])

ISfcValidate implementation for Policy

Events

propertyChanged propertyChanged propertyChanged Inherited from SfcInstance
PropertyChanged PropertyChanged PropertyChanged Inherited from SfcInstance
propertyMetadataChanged propertyMetadataChanged propertyMetadataChanged Inherited from SfcInstance
PropertyMetadataChanged PropertyMetadataChanged PropertyMetadataChanged Inherited from SfcInstance

Applies to