Open sandboxFocus

Class PolicyConfigurationModel

Type of the source XML element. The parent of the source element is verbosity (see VerbosityConfigurationModel).

Inheritance
PolicyConfigurationModel
Namespace: PostSharp.Patterns.Diagnostics.Transactions.Model
Assembly: PostSharp.Patterns.Diagnostics.Configuration.dll
Syntax
public sealed class PolicyConfigurationModel
Remarks

This class should not be used in any code. It is only mentioned for the sake of documenting the XML file.

Properties

Name Description
If

A C# predicate mapping a parameter t to a bool that determines whether the current policy matches the transaction t. The type of t is OpenTransactionExpressionModel<T>, which is a generic type. The generic type argument, and the type of the Request property, depend on the type of transaction, that is, on the Type attribute. When the transaction type is AspNetCoreRequest, the expression model type is AspNetCoreRequestExpressionModel. For custom transactions, the type is the value of the expression model specified in the LogEventMetadata. This expression can call Matches(string, string) to evaluate a regular expression.

Name

The name of the policy. This attribute is optional. It is useful only for debugging.

Sample

A C# predicate mapping a parameter t to a bool that determines whether the current transaction, after it has been matched by the If predicate, must actually be logged. This attribute typically contains a call to Random(double) or OnceEveryXSeconds(double, string).

Type

Type of the transactions matched by this policy. The only supported type is AspNetCoreRequest. For custom transactions, this property must match the name of the LogEventMetadata that describes the transaction.