Classe Policy
The Policy object represents a Policy-Based Management policy. A policy represents the relationship between a target object and a condition.
Gerarchia di ereditarietà
System. . :: . .Object
Microsoft.SqlServer.Management.Sdk.Sfc. . :: . .SfcInstance
Microsoft.SqlServer.Management.Dmf..::..Policy
Spazio dei nomi Microsoft.SqlServer.Management.Dmf
Assembly: Microsoft.SqlServer.Dmf (in Microsoft.SqlServer.Dmf.dll)
Sintassi
'Dichiarazione
<StrongNameIdentityPermissionAttribute(SecurityAction.LinkDemand, PublicKey := "0024000004800000940000000602000000240000525341310004000001000100272736ad6e5f9586bac2d531eabc3acc666c2f8ec879fa94f8f7b0327d2ff2ed523448f83c3d5c5dd2dfc7bc99c5286b2c125117bf5cbe242b9d41750732b2bdffe649c6efb8e5526d526fdd130095ecdb7bf210809c6cdad8824faa9ac0310ac3cba2aa0523567b2dfa7fe250b30facbd62d4ec99b94ac47c7d3b28f1f6e4c8")> _
<StrongNameIdentityPermissionAttribute(SecurityAction.LinkDemand, PublicKey := "0024000004800000940000000602000000240000525341310004000001000100272736ad6e5f9586bac2d531eabc3acc666c2f8ec879fa94f8f7b0327d2ff2ed523448f83c3d5c5dd2dfc7bc99c5286b2c125117bf5cbe242b9d41750732b2bdffe649c6efb8e5526d526fdd130095ecdb7bf210809c6cdad8824faa9ac0310ac3cba2aa0523567b2dfa7fe250b30facbd62d4ec99b94ac47c7d3b28f1f6e4c8")> _
Public NotInheritable Class Policy _
Inherits SfcInstance _
Implements ISfcCreatable, ICreatable, ISfcDroppable, IDroppable, _
ISfcAlterable, IAlterable, ISfcRenamable, IRenamable, ISfcValidate
'Utilizzo
Dim instance As Policy
[StrongNameIdentityPermissionAttribute(SecurityAction.LinkDemand, PublicKey = "0024000004800000940000000602000000240000525341310004000001000100272736ad6e5f9586bac2d531eabc3acc666c2f8ec879fa94f8f7b0327d2ff2ed523448f83c3d5c5dd2dfc7bc99c5286b2c125117bf5cbe242b9d41750732b2bdffe649c6efb8e5526d526fdd130095ecdb7bf210809c6cdad8824faa9ac0310ac3cba2aa0523567b2dfa7fe250b30facbd62d4ec99b94ac47c7d3b28f1f6e4c8")]
[StrongNameIdentityPermissionAttribute(SecurityAction.LinkDemand, PublicKey = "0024000004800000940000000602000000240000525341310004000001000100272736ad6e5f9586bac2d531eabc3acc666c2f8ec879fa94f8f7b0327d2ff2ed523448f83c3d5c5dd2dfc7bc99c5286b2c125117bf5cbe242b9d41750732b2bdffe649c6efb8e5526d526fdd130095ecdb7bf210809c6cdad8824faa9ac0310ac3cba2aa0523567b2dfa7fe250b30facbd62d4ec99b94ac47c7d3b28f1f6e4c8")]
public sealed class Policy : SfcInstance,
ISfcCreatable, ICreatable, ISfcDroppable, IDroppable, ISfcAlterable,
IAlterable, ISfcRenamable, IRenamable, ISfcValidate
[StrongNameIdentityPermissionAttribute(SecurityAction::LinkDemand, PublicKey = L"0024000004800000940000000602000000240000525341310004000001000100272736ad6e5f9586bac2d531eabc3acc666c2f8ec879fa94f8f7b0327d2ff2ed523448f83c3d5c5dd2dfc7bc99c5286b2c125117bf5cbe242b9d41750732b2bdffe649c6efb8e5526d526fdd130095ecdb7bf210809c6cdad8824faa9ac0310ac3cba2aa0523567b2dfa7fe250b30facbd62d4ec99b94ac47c7d3b28f1f6e4c8")]
[StrongNameIdentityPermissionAttribute(SecurityAction::LinkDemand, PublicKey = L"0024000004800000940000000602000000240000525341310004000001000100272736ad6e5f9586bac2d531eabc3acc666c2f8ec879fa94f8f7b0327d2ff2ed523448f83c3d5c5dd2dfc7bc99c5286b2c125117bf5cbe242b9d41750732b2bdffe649c6efb8e5526d526fdd130095ecdb7bf210809c6cdad8824faa9ac0310ac3cba2aa0523567b2dfa7fe250b30facbd62d4ec99b94ac47c7d3b28f1f6e4c8")]
public ref class Policy sealed : public SfcInstance,
ISfcCreatable, ICreatable, ISfcDroppable, IDroppable, ISfcAlterable,
IAlterable, ISfcRenamable, IRenamable, ISfcValidate
[<SealedAttribute>]
[<StrongNameIdentityPermissionAttribute(SecurityAction.LinkDemand, PublicKey = "0024000004800000940000000602000000240000525341310004000001000100272736ad6e5f9586bac2d531eabc3acc666c2f8ec879fa94f8f7b0327d2ff2ed523448f83c3d5c5dd2dfc7bc99c5286b2c125117bf5cbe242b9d41750732b2bdffe649c6efb8e5526d526fdd130095ecdb7bf210809c6cdad8824faa9ac0310ac3cba2aa0523567b2dfa7fe250b30facbd62d4ec99b94ac47c7d3b28f1f6e4c8")>]
[<StrongNameIdentityPermissionAttribute(SecurityAction.LinkDemand, PublicKey = "0024000004800000940000000602000000240000525341310004000001000100272736ad6e5f9586bac2d531eabc3acc666c2f8ec879fa94f8f7b0327d2ff2ed523448f83c3d5c5dd2dfc7bc99c5286b2c125117bf5cbe242b9d41750732b2bdffe649c6efb8e5526d526fdd130095ecdb7bf210809c6cdad8824faa9ac0310ac3cba2aa0523567b2dfa7fe250b30facbd62d4ec99b94ac47c7d3b28f1f6e4c8")>]
type Policy =
class
inherit SfcInstance
interface ISfcCreatable
interface ICreatable
interface ISfcDroppable
interface IDroppable
interface ISfcAlterable
interface IAlterable
interface ISfcRenamable
interface IRenamable
interface ISfcValidate
end
public final class Policy extends SfcInstance implements ISfcCreatable, ICreatable, ISfcDroppable, IDroppable, ISfcAlterable, IAlterable, ISfcRenamable, IRenamable, ISfcValidate
Nel tipo Policy sono esposti i membri seguenti.
Costruttori
Nome | Descrizione | |
---|---|---|
![]() |
Policy() () () () | Initializes a new instance of the Policy class. |
![]() |
Policy(PolicyStore, String) | Initializes a new instance of the Policy class. |
In alto
Proprietà
Nome | Descrizione | |
---|---|---|
![]() |
AbstractIdentityKey | Non fare riferimento direttamente a questo membro nel codice. Supporta l'infrastruttura di SQL Server. Ereditato da SfcInstance. |
![]() |
AutomatedPolicyEvaluationMode | Gets or sets the evaluation mode. |
![]() |
CategoryId | Gets the ID value that uniquely identifies the category that is associated with the policy. |
![]() |
Condition | Gets or sets the condition. |
![]() |
CreateDate | Gets the date and time when the policy was created. |
![]() |
CreatedBy | Gets the policy store authentication credentials of the user who created the policy. |
![]() |
DateModified | Gets the date and time when the policy was last modified. |
![]() |
Description | Gets or sets the textual description of the policy. |
![]() |
Enabled | Gets or set the Boolean value that specifies whether the policy is enabled. |
![]() |
EvaluationHistories | Gets the evaluation histories collection. |
![]() |
HasScript | Gets the Boolean value that specifies whether the policy has a script. |
![]() |
HelpLink | Gets or sets a URN to additional help information for the policy. |
![]() |
HelpText | Gets or sets the display name for the help text. |
![]() |
ID | Gets the ID value that uniquely identifies the policy. |
![]() |
IdentityKey | Gets the key that identifies the policy. |
![]() |
IsSystemObject | Determines whether the Policy object is a Object. |
![]() |
Metadata | Returns metadata about the instance and its domain. Ereditato da SfcInstance. |
![]() |
ModifiedBy | Gets the policy store authentication credentials of the user who last modified the policy. |
![]() |
Name | Gets the name of the Policy object. |
![]() |
ObjectSet | Gets or sets the set of objects that are associated with the policy. |
![]() |
Parent | Gets or sets the PolicyStore that is the parent of the policy object. |
![]() |
PolicyCategory | Gets or sets the category that is associated with the policy. |
![]() |
Properties | Returns a collection instance properties. Ereditato da SfcInstance. |
![]() |
PropertyStorageProvider | Non fare riferimento direttamente a questo membro nel codice. Supporta l'infrastruttura di SQL Server. Ereditato da SfcInstance. |
![]() |
RootCondition | Gets or sets the name of the root condition for this policy. |
![]() |
ScheduleUid | Gets or sets the Guid that identifies the SQL Server Agent schedule that checks on the policy. |
![]() |
State | Returns the state of the SfcInstance object. Ereditato da SfcInstance. |
![]() |
Urn | Returns the uniform resource name of the SfcInstance object. Ereditato da SfcInstance. |
In alto
Metodi
Nome | Descrizione | |
---|---|---|
![]() |
Alter | Updates any Policy object property changes on the instance of SQL Server. |
![]() |
AlterImpl | Non fare riferimento direttamente a questo membro nel codice. Supporta l'infrastruttura di SQL Server. Ereditato da SfcInstance. |
![]() |
CheckObjectCreated | Non fare riferimento direttamente a questo membro nel codice. Supporta l'infrastruttura di SQL Server. Ereditato da SfcInstance. |
![]() |
CheckObjectState | Non fare riferimento direttamente a questo membro nel codice. Supporta l'infrastruttura di SQL Server. Ereditato da SfcInstance. |
![]() |
Create | Creates management policy item. |
![]() |
CreateIdentityKey | Non fare riferimento direttamente a questo membro nel codice. Supporta l'infrastruttura di SQL Server. Ereditato da SfcInstance. |
![]() |
CreateImpl | Non fare riferimento direttamente a questo membro nel codice. Supporta l'infrastruttura di SQL Server. Ereditato da SfcInstance. |
![]() |
Discover | Discovers conditions in the ObjectSet and adds them to the ISfcDependencyDiscoveryObjectSink identified by the sink parameter. Esegue l'override di SfcInstance. . :: . .Discover(ISfcDependencyDiscoveryObjectSink). |
![]() |
Drop | Removes the policy from the instance of SQL Server. |
![]() |
DropImpl | Non fare riferimento direttamente a questo membro nel codice. Supporta l'infrastruttura di SQL Server. Ereditato da SfcInstance. |
![]() |
Equals | Ereditato da Object. |
![]() |
Evaluate(AdHocPolicyEvaluationMode, array<ISfcConnection> [] () [] []) | Evaluates the Policy object and applies policy to the data in identified by the targetConnections parameter. |
![]() |
Evaluate(AdHocPolicyEvaluationMode, array<Object> [] () [] []) | Immediately executes the policy against the specified target objects by using the specified evaluation mode. |
![]() |
Evaluate(AdHocPolicyEvaluationMode, SfcQueryExpression, array<ISfcConnection> [] () [] []) | Evaluates the Policy object and applies policy to the data in identified by the targetConnections parameter. |
![]() |
Finalize | Ereditato da Object. |
![]() |
GetChildCollection | Non fare riferimento direttamente a questo membro nel codice. Supporta l'infrastruttura di SQL Server. Ereditato da SfcInstance. |
![]() |
GetDomain | Non fare riferimento direttamente a questo membro nel codice. Supporta l'infrastruttura di SQL Server. Ereditato da SfcInstance. |
![]() |
GetHashCode | Ereditato da Object. |
![]() ![]() |
GetObjectFactory | Gets the object factory for the object. |
![]() |
GetPropertySet | Returns the set of properties for the SfcInstance object. Ereditato da SfcInstance. |
![]() |
GetType | Ereditato da Object. |
![]() |
GetTypeMetadataImpl | Indicates the domains that override by returning the right TypeMetadata class directly. Non fare riferimento direttamente a questo membro nel codice. Supporta l'infrastruttura di SQL Server. Ereditato da SfcInstance. |
![]() |
InitializeUIPropertyState | Non fare riferimento direttamente a questo membro nel codice. Supporta l'infrastruttura di SQL Server. Ereditato da SfcInstance. |
![]() |
MarkForDropImpl | Returns a value that indicates the existing objects to be dropped. Non fare riferimento direttamente a questo membro nel codice. Supporta l'infrastruttura di SQL Server. Ereditato da SfcInstance. |
![]() |
MarkRootAsConnected | Non fare riferimento direttamente a questo membro nel codice. Supporta l'infrastruttura di SQL Server. Ereditato da SfcInstance. |
![]() |
MemberwiseClone | Ereditato da Object. |
![]() |
MoveImpl | Indicates the new parent object to move in an instance. Non fare riferimento direttamente a questo membro nel codice. Supporta l'infrastruttura di SQL Server. Ereditato da SfcInstance. |
![]() |
OnPropertyMetadataChanges | Invoked whenever the effective value of any SfcInstance metadata is updated. Ereditato da SfcInstance. |
![]() |
OnPropertyValueChanges | Invoked whenever the effective value of any SfcInstance property is updated. Ereditato da SfcInstance. |
![]() |
PostAlter | Non fare riferimento direttamente a questo membro nel codice. Supporta l'infrastruttura di SQL Server. Ereditato da SfcInstance. |
![]() |
PostCreate | Indicates the default implementor that creates the execution result. Non fare riferimento direttamente a questo membro nel codice. Supporta l'infrastruttura di SQL Server. Ereditato da SfcInstance. |
![]() |
PostDrop | Non fare riferimento direttamente a questo membro nel codice. Supporta l'infrastruttura di SQL Server. Ereditato da SfcInstance. |
![]() |
PostMove | Non fare riferimento direttamente a questo membro nel codice. Supporta l'infrastruttura di SQL Server. Ereditato da SfcInstance. |
![]() |
PostRename | Non fare riferimento direttamente a questo membro nel codice. Supporta l'infrastruttura di SQL Server. Ereditato da SfcInstance. |
![]() |
ProduceConfigureScript | Gets the condition of a Policy object. |
![]() |
Refresh | Refreshes the object's properties by reading them from the server. Ereditato da SfcInstance. |
![]() |
Rename | Renames the policy. |
![]() |
RenameImpl | Non fare riferimento direttamente a questo membro nel codice. Supporta l'infrastruttura di SQL Server. Ereditato da SfcInstance. |
![]() |
ResetKey | Non fare riferimento direttamente a questo membro nel codice. Supporta l'infrastruttura di SQL Server. Ereditato da SfcInstance. |
![]() |
ScriptAlter | Alters the script that is used to create the policy. |
![]() |
ScriptAlterWithObjectSet | Alters a previously created ISfcScript object of the Policy object. |
![]() |
ScriptCreate | Creates a script that is used to create the policy. |
![]() |
ScriptCreateWithDependencies | Creates the ISfcScript object of the Policy object. |
![]() |
ScriptCreateWithObjectSet | Creates the ISfcScript object of the ObjectSet. |
![]() |
ScriptDrop | Drops the script that is used to create the policy. |
![]() |
ScriptDropWithObjectSet | Drops the ISfcScript object of the ObjectSet. |
![]() |
Serialize | Serializes the instance to XML. Ereditato da SfcInstance. |
![]() |
ToString | Returns a string representation of the instance Urn. Ereditato da SfcInstance. |
![]() |
UpdateUIPropertyState | Non fare riferimento direttamente a questo membro nel codice. Supporta l'infrastruttura di SQL Server. Ereditato da SfcInstance. |
![]() |
UsesFacet | Determines whether the facet identified by the parameter is contained by the Condition. |
![]() |
Validate() () () () | Indicates the basic child object's validation. Non fare riferimento direttamente a questo membro nel codice. Supporta l'infrastruttura di SQL Server. Ereditato da SfcInstance. |
![]() |
Validate(String) | Validates a Policy object as specified by the mode parameter. |
In alto
Eventi
Nome | Descrizione | |
---|---|---|
![]() |
ConnectionProcessingFinished | Represents the event activated when connection processing completes. |
![]() |
ConnectionProcessingStarted | Represents the event activated when connection processing begins. |
![]() |
PolicyEvaluationFinished | Represents the event activated when policy evaluation completes. |
![]() |
PolicyEvaluationStarted | Represents the event activated when policy evaluation begins. |
![]() |
propertyChanged | Non fare riferimento direttamente a questo membro nel codice. Supporta l'infrastruttura di SQL Server. Ereditato da SfcInstance. |
![]() |
PropertyChanged | CLS-compliant event for property changes. Ereditato da SfcInstance. |
![]() |
propertyMetadataChanged | Non fare riferimento direttamente a questo membro nel codice. Supporta l'infrastruttura di SQL Server. Ereditato da SfcInstance. |
![]() |
PropertyMetadataChanged | CLS-compliant event for property metadata changes. Ereditato da SfcInstance. |
![]() |
TargetProcessed | Represents the event activated when policy target is processed. |
In alto
Campi
Nome | Descrizione | |
---|---|---|
![]() ![]() |
HelpLinkStringMaxLength | Specifies the maximum length of the link to help text. |
![]() ![]() |
HelpTextStringMaxLength | Specifies the maximum length of the help text. |
In alto
Implementazioni esplicite dell'interfaccia
Nome | Descrizione | |
---|---|---|
![]() ![]() |
ISfcRenamable. . :: . .Rename | Renames the instance of Policy identified by the key parameter. |
![]() ![]() |
ISfcRenamable. . :: . .ScriptRename | Renames a script in the policy. |
![]() ![]() |
ISfcValidate. . :: . .Validate | Validates a Policy object. |
In alto
Osservazioni
A policy represents the relationship between an individual object or a target set of objects and a condition.
A target is an entity on an instance of SQL Server. It could be the instance of SQL Server, or a component of it, such as a database or a table.
A condition is a relationship between a facet and a Boolean expression that determine the state of the facet. A facet is a dimension of a target. For example, the target could be an instance of SQL Server, the facet is Database Mail, the expression specifies that it is installed on the instance and the condition is that Database Mail is installed. Thus, the policy is that Database Mail is installed on the specified instance of SQL Server.
The evaluation mode of the policy determines how and when the policy is checked and enforced.
Using the Policy object, you can manage the following characteristics of a policy:
Condition
Evaluation mode
Schedule
Target set filter using XPath expression
A job on evaluation success
A job on evaluation failure
A policy group
Esempi
C#
Policy p = new Policy(ps, policyName);
p.AutomatedPolicyEvaluationMode = execMode;
p.Condition = condition.Name;
p.ScheduleUid = schedule.ScheduleUid;
if (execMode != AutomatedPolicyEvaluationMode.None) p.Enabled = true;
p.Create();
Protezione dei thread
I membri static (Shared in Visual Basic) pubblici di questo tipo sono affidabili. Non è invece garantita la sicurezza dei membri dell'istanza.
Vedere anche