CSLA .NET 10.0.0
A home for your business logic
Loading...
Searching...
No Matches
Csla.Rules.IRuleContext Interface Reference

Context information provided to a business rule when it is invoked. More...

Inheritance diagram for Csla.Rules.IRuleContext:
Csla.Rules.RuleContext

Public Member Functions

void ExecuteRule (IBusinessRuleBase innerRule)
 Executes the inner rule from the outer rules context. Creates a chained context and if CanRunRule will execute the inner rule.
IRuleContext GetChainedContext (IBusinessRuleBase rule)
 Gets a new RuleContext object for a chained rule.
void AddErrorResult (string description)
 Add a Error severity result to the Results list.
void AddErrorResult (string description, bool stopProcessing)
 Add a Error severity result to the Results list.
void AddErrorResult (IPropertyInfo property, string description)
 Add a Error severity result to the Results list. This method is only allowed on "object" level rules to allow an object level rule to set warning result on a field.
void AddWarningResult (string description)
 Add a Warning severity result to the Results list.
void AddWarningResult (string description, bool stopProcessing)
 Add a Warning severity result to the Results list.
void AddWarningResult (IPropertyInfo property, string description)
 Add a Warning severity result to the Results list. This method is only allowed on "object" level rules to allow an object level rule to set warning result on a field.
void AddInformationResult (string description)
 Add an Information severity result to the Results list.
void AddInformationResult (string description, bool stopProcessing)
 Add an Information severity result to the Results list.
void AddInformationResult (IPropertyInfo property, string description)
 Add an Information severity result to the Results list. This method is only allowed on "object" level rules to allow an object level rule to set warning result on a field.
void AddSuccessResult (bool stopProcessing)
 Add a Success severity result to the Results list.
void AddOutValue (object? value)
 Add an outbound value to update the rule's primary property on the business object once the rule is complete.
void AddOutValue (IPropertyInfo property, object? value)
 Add an outbound value to update a property on the business object once the rule is complete.
void AddDirtyProperty (IPropertyInfo property)
 Adds a property name as a dirty field (changed value).
void Complete ()
 Indicates that the rule processing is complete, so CSLA .NET will process the Results list. This method must be invoked on the UI thread.
T? GetInputValue<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] T > (PropertyInfo< T > propertyInfo)
 Gets the value.
T? GetInputValue< T > (IPropertyInfo propertyInfo)
 Gets the value with explicit cast.
bool TryGetInputValue<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] T > (PropertyInfo< T > propertyInfo, ref T? value)
 Tries to get the value. Use this method on LazyLoaded properties to test if value has been provided or not.
bool TryGetInputValue< T > (IPropertyInfo propertyInfo, ref T? value)
 Tries to get the value with explicit cast. Use this method on LazyLoaded properties to test if value has been provided or not.

Properties

IBusinessRuleBase Rule [get]
 Gets the rule object.
object? Target [get]
 Gets a reference to the target business object.
Dictionary< IPropertyInfo, object?> InputPropertyValues [get]
 Gets a dictionary containing copies of property values from the target business object.
List< IPropertyInfoDirtyProperties [get]
 Gets a list of dirty properties (value was updated).
Dictionary< IPropertyInfo, object?> OutputPropertyValues [get]
 Gets a dictionary containing copies of property values that should be updated in the target object.
List< RuleResultResults [get]
 Gets a list of RuleResult objects containing the results of the rule.
string OriginPropertyName [get]
 Gets or sets the name of the origin property.
bool IsCascadeContext [get]
 Gets a value indicating whether this instance is cascade context as a result of AffectedProperties.
bool IsPropertyChangedContext [get]
 Gets a value indicating whether this instance is property changed context.
bool IsCheckRulesContext [get]
 Gets a value indicating whether this instance is check rules context.
bool IsCheckObjectRulesContext [get]
 Gets a value indicating whether this instance is check object rules context.
RuleContextModes ExecuteContext [get]
 Gets the execution context.
ApplicationContext ApplicationContext [get]
 Gets a reference to the current ApplicationContext.
IDataPortalFactory DataPortalFactory [get]
 Gets a data portal factory instance.

Detailed Description

Context information provided to a business rule when it is invoked.

Member Function Documentation

◆ AddDirtyProperty()

void Csla.Rules.IRuleContext.AddDirtyProperty ( IPropertyInfo property)

Adds a property name as a dirty field (changed value).

Parameters
propertyThe property.
Exceptions
ArgumentNullExceptionproperty is null.
System.ArgumentOutOfRangeException

Implemented in Csla.Rules.RuleContext.

◆ AddErrorResult() [1/3]

void Csla.Rules.IRuleContext.AddErrorResult ( IPropertyInfo property,
string description )

Add a Error severity result to the Results list. This method is only allowed on "object" level rules to allow an object level rule to set warning result on a field.

Parameters
propertyProperty to which the result applies.
descriptionHuman-readable description of why the rule failed.
Exceptions
ArgumentNullExceptionproperty is null.
System.ArgumentOutOfRangeExceptionWhen property is not defined in AffectedProperties list.
ArgumentExceptiondescription is null, string.Empty or only consists of white spaces.

Implemented in Csla.Rules.RuleContext.

◆ AddErrorResult() [2/3]

void Csla.Rules.IRuleContext.AddErrorResult ( string description)

Add a Error severity result to the Results list.

Parameters
descriptionHuman-readable description of why the rule failed.
Exceptions
ArgumentExceptiondescription is null, string.Empty or only consists of white spaces.

Implemented in Csla.Rules.RuleContext.

◆ AddErrorResult() [3/3]

void Csla.Rules.IRuleContext.AddErrorResult ( string description,
bool stopProcessing )

Add a Error severity result to the Results list.

Parameters
descriptionHuman-readable description of why the rule failed.
stopProcessingTrue if no further rules should be processed for the current property.
Exceptions
ArgumentExceptiondescription is null, string.Empty or only consists of white spaces.

Implemented in Csla.Rules.RuleContext.

◆ AddInformationResult() [1/3]

void Csla.Rules.IRuleContext.AddInformationResult ( IPropertyInfo property,
string description )

Add an Information severity result to the Results list. This method is only allowed on "object" level rules to allow an object level rule to set warning result on a field.

Parameters
propertyProperty to which the result applies.
descriptionHuman-readable description of why the rule failed.
Exceptions
ArgumentNullExceptionproperty is null.
System.ArgumentOutOfRangeExceptionWhen property is not defined in AffectedProperties list.
ArgumentExceptiondescription is null, string.Empty or only consists of white spaces.

Implemented in Csla.Rules.RuleContext.

◆ AddInformationResult() [2/3]

void Csla.Rules.IRuleContext.AddInformationResult ( string description)

Add an Information severity result to the Results list.

Parameters
descriptionHuman-readable description of why the rule failed.
Exceptions
ArgumentExceptiondescription is null, string.Empty or only consists of white spaces.

Implemented in Csla.Rules.RuleContext.

◆ AddInformationResult() [3/3]

void Csla.Rules.IRuleContext.AddInformationResult ( string description,
bool stopProcessing )

Add an Information severity result to the Results list.

Parameters
descriptionHuman-readable description of why the rule failed.
stopProcessingTrue if no further rules should be processed for the current property.
Exceptions
ArgumentExceptiondescription is null, string.Empty or only consists of white spaces.

Implemented in Csla.Rules.RuleContext.

◆ AddOutValue() [1/2]

void Csla.Rules.IRuleContext.AddOutValue ( IPropertyInfo property,
object? value )

Add an outbound value to update a property on the business object once the rule is complete.

Parameters
propertyProperty to update.
valueNew property value.
Exceptions
ArgumentNullExceptionproperty is null.
System.ArgumentOutOfRangeExceptionWhen property is not defined in AffectedProperties list.

Implemented in Csla.Rules.RuleContext.

◆ AddOutValue() [2/2]

void Csla.Rules.IRuleContext.AddOutValue ( object? value)

Add an outbound value to update the rule's primary property on the business object once the rule is complete.

Parameters
valueNew property value.
Exceptions
InvalidOperationExceptionRule.IBusinessRuleBase.PrimaryProperty is null.

Implemented in Csla.Rules.RuleContext.

◆ AddSuccessResult()

void Csla.Rules.IRuleContext.AddSuccessResult ( bool stopProcessing)

Add a Success severity result to the Results list.

Parameters
stopProcessingTrue if no further rules should be processed for the current property.

Implemented in Csla.Rules.RuleContext.

◆ AddWarningResult() [1/3]

void Csla.Rules.IRuleContext.AddWarningResult ( IPropertyInfo property,
string description )

Add a Warning severity result to the Results list. This method is only allowed on "object" level rules to allow an object level rule to set warning result on a field.

Parameters
propertyProperty to which the result applies.
descriptionHuman-readable description of why the rule failed.
Exceptions
ArgumentNullExceptionproperty is null.
System.ArgumentOutOfRangeExceptionWhen property is not defined in AffectedProperties list.
ArgumentExceptiondescription is null, string.Empty or only consists of white spaces.

Implemented in Csla.Rules.RuleContext.

◆ AddWarningResult() [2/3]

void Csla.Rules.IRuleContext.AddWarningResult ( string description)

Add a Warning severity result to the Results list.

Parameters
descriptionHuman-readable description of why the rule failed.
Exceptions
ArgumentExceptiondescription is null, string.Empty or only consists of white spaces.

Implemented in Csla.Rules.RuleContext.

◆ AddWarningResult() [3/3]

void Csla.Rules.IRuleContext.AddWarningResult ( string description,
bool stopProcessing )

Add a Warning severity result to the Results list.

Parameters
descriptionHuman-readable description of why the rule failed.
stopProcessingTrue if no further rules should be processed for the current property.
Exceptions
ArgumentExceptiondescription is null, string.Empty or only consists of white spaces.

Implemented in Csla.Rules.RuleContext.

◆ Complete()

void Csla.Rules.IRuleContext.Complete ( )

Indicates that the rule processing is complete, so CSLA .NET will process the Results list. This method must be invoked on the UI thread.

Implemented in Csla.Rules.RuleContext.

◆ ExecuteRule()

void Csla.Rules.IRuleContext.ExecuteRule ( IBusinessRuleBase innerRule)

Executes the inner rule from the outer rules context. Creates a chained context and if CanRunRule will execute the inner rule.

Parameters
innerRuleThe inner rule.
Exceptions
ArgumentNullExceptioninnerRule is null.

Implemented in Csla.Rules.RuleContext.

◆ GetChainedContext()

IRuleContext Csla.Rules.IRuleContext.GetChainedContext ( IBusinessRuleBase rule)

Gets a new RuleContext object for a chained rule.

Parameters
ruleChained rule that will use this new context.

The properties from the existing RuleContext will be used to create the new context, with the exception of the Rule property which is set using the supplied IBusinessRule value.

Exceptions
ArgumentNullExceptionrule is null.

Implemented in Csla.Rules.RuleContext.

◆ GetInputValue< T >()

T? Csla.Rules.IRuleContext.GetInputValue< T > ( IPropertyInfo propertyInfo)

Gets the value with explicit cast.

Template Parameters
T
Parameters
propertyInfoThe generic property info.
Exceptions
ArgumentNullExceptionpropertyInfo is null.

Implemented in Csla.Rules.RuleContext.

◆ GetInputValue<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] T >()

T? Csla.Rules.IRuleContext.GetInputValue<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] T > ( PropertyInfo< T > propertyInfo)

Gets the value.

Template Parameters
T
Parameters
propertyInfoThe property info.
Exceptions
ArgumentNullExceptionpropertyInfo is null.

Implemented in Csla.Rules.RuleContext.

◆ TryGetInputValue< T >()

bool Csla.Rules.IRuleContext.TryGetInputValue< T > ( IPropertyInfo propertyInfo,
ref T? value )

Tries to get the value with explicit cast. Use this method on LazyLoaded properties to test if value has been provided or not.

Template Parameters
T
Parameters
propertyInfoThe generic property info.
valueThe value.
Returns
true if value exists else false
Exceptions
ArgumentNullExceptionpropertyInfo is null.

Implemented in Csla.Rules.RuleContext.

◆ TryGetInputValue<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] T >()

bool Csla.Rules.IRuleContext.TryGetInputValue<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] T > ( PropertyInfo< T > propertyInfo,
ref T? value )

Tries to get the value. Use this method on LazyLoaded properties to test if value has been provided or not.

Template Parameters
T
Parameters
propertyInfoThe generic property info.
valueThe value.
Returns
true if value exists else false
Exceptions
ArgumentNullExceptionpropertyInfo is null.

Implemented in Csla.Rules.RuleContext.

Property Documentation

◆ ApplicationContext

ApplicationContext Csla.Rules.IRuleContext.ApplicationContext
get

Gets a reference to the current ApplicationContext.

Implemented in Csla.Rules.RuleContext.

◆ DataPortalFactory

IDataPortalFactory Csla.Rules.IRuleContext.DataPortalFactory
get

Gets a data portal factory instance.

Implemented in Csla.Rules.RuleContext.

◆ DirtyProperties

List<IPropertyInfo> Csla.Rules.IRuleContext.DirtyProperties
get

Gets a list of dirty properties (value was updated).

The dirty properties.

Implemented in Csla.Rules.RuleContext.

◆ ExecuteContext

RuleContextModes Csla.Rules.IRuleContext.ExecuteContext
get

Gets the execution context.

The execution context.

Implemented in Csla.Rules.RuleContext.

◆ InputPropertyValues

Dictionary<IPropertyInfo, object?> Csla.Rules.IRuleContext.InputPropertyValues
get

Gets a dictionary containing copies of property values from the target business object.

Implemented in Csla.Rules.RuleContext.

◆ IsCascadeContext

bool Csla.Rules.IRuleContext.IsCascadeContext
get

Gets a value indicating whether this instance is cascade context as a result of AffectedProperties.

true if this instance is cascade context; otherwise, false.

Implemented in Csla.Rules.RuleContext.

◆ IsCheckObjectRulesContext

bool Csla.Rules.IRuleContext.IsCheckObjectRulesContext
get

Gets a value indicating whether this instance is check object rules context.

true if this instance is check object rules context; otherwise, false.

Implemented in Csla.Rules.RuleContext.

◆ IsCheckRulesContext

bool Csla.Rules.IRuleContext.IsCheckRulesContext
get

Gets a value indicating whether this instance is check rules context.

true if this instance is check rules context; otherwise, false.

Implemented in Csla.Rules.RuleContext.

◆ IsPropertyChangedContext

bool Csla.Rules.IRuleContext.IsPropertyChangedContext
get

Gets a value indicating whether this instance is property changed context.

true if this instance is property changed context; otherwise, false.

Implemented in Csla.Rules.RuleContext.

◆ OriginPropertyName

string Csla.Rules.IRuleContext.OriginPropertyName
get

Gets or sets the name of the origin property.

The name of the origin property.

Implemented in Csla.Rules.RuleContext.

◆ OutputPropertyValues

Dictionary<IPropertyInfo, object?> Csla.Rules.IRuleContext.OutputPropertyValues
get

Gets a dictionary containing copies of property values that should be updated in the target object.

Implemented in Csla.Rules.RuleContext.

◆ Results

List<RuleResult> Csla.Rules.IRuleContext.Results
get

Gets a list of RuleResult objects containing the results of the rule.

Implemented in Csla.Rules.RuleContext.

◆ Rule

IBusinessRuleBase Csla.Rules.IRuleContext.Rule
get

Gets the rule object.

Implemented in Csla.Rules.RuleContext.

◆ Target

object? Csla.Rules.IRuleContext.Target
get

Gets a reference to the target business object.

Implemented in Csla.Rules.RuleContext.


The documentation for this interface was generated from the following file: