CSLA.NET 6.0.0
CSLA .NET is a software development framework that helps you build a reusable, maintainable object-oriented business layer for your app.
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. More...
 
IRuleContext GetChainedContext (IBusinessRuleBase rule)
 Gets a new RuleContext object for a chained rule. More...
 
void AddErrorResult (string description)
 Add a Error severity result to the Results list. More...
 
void AddErrorResult (string description, bool stopProcessing)
 Add a Error severity result to the Results list. More...
 
void AddErrorResult (Csla.Core.IPropertyInfo property, string description)
 Add a Error severity result to the Results list. More...
 
void AddWarningResult (string description)
 Add a Warning severity result to the Results list. More...
 
void AddWarningResult (string description, bool stopProcessing)
 Add a Warning severity result to the Results list. More...
 
void AddWarningResult (Csla.Core.IPropertyInfo property, string description)
 Add a Warning severity result to the Results list. More...
 
void AddInformationResult (string description)
 Add an Information severity result to the Results list. More...
 
void AddInformationResult (string description, bool stopProcessing)
 Add an Information severity result to the Results list. More...
 
void AddInformationResult (Csla.Core.IPropertyInfo property, string description)
 Add an Information severity result to the Results list. More...
 
void AddSuccessResult (bool stopProcessing)
 Add a Success severity result to the Results list. More...
 
void AddOutValue (object value)
 Add an outbound value to update the rule's primary property on the business object once the rule is complete. More...
 
void AddOutValue (Csla.Core.IPropertyInfo property, object value)
 Add an outbound value to update a property on the business object once the rule is complete. More...
 
void AddDirtyProperty (Csla.Core.IPropertyInfo property)
 Adds a property name as a dirty field (changed value). More...
 
void Complete ()
 Indicates that the rule processing is complete, so CSLA .NET will process the Results list. More...
 
GetInputValue< T > (PropertyInfo< T > propertyInfo)
 Gets the value. More...
 
GetInputValue< T > (IPropertyInfo propertyInfo)
 Gets the value with explicit cast More...
 
bool TryGetInputValue< T > (PropertyInfo< T > propertyInfo, ref T value)
 Tries to get the value. More...
 
bool TryGetInputValue< T > (IPropertyInfo propertyInfo, ref T value)
 Tries to get the value with explicit cast. More...
 

Properties

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

Detailed Description

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

Definition at line 21 of file IRuleContext.cs.

Member Function Documentation

◆ AddDirtyProperty()

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

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

Parameters
propertyThe property.
Exceptions
System.ArgumentOutOfRangeException

Implemented in Csla.Rules.RuleContext.

◆ AddErrorResult() [1/3]

void Csla.Rules.IRuleContext.AddErrorResult ( Csla.Core.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
System.ArgumentOutOfRangeExceptionWhen property is not defined in AffectedProperties list.


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.

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.

Implemented in Csla.Rules.RuleContext.

◆ AddInformationResult() [1/3]

void Csla.Rules.IRuleContext.AddInformationResult ( Csla.Core.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
System.ArgumentOutOfRangeExceptionWhen property is not defined in AffectedProperties list.


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.

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.

Implemented in Csla.Rules.RuleContext.

◆ AddOutValue() [1/2]

void Csla.Rules.IRuleContext.AddOutValue ( Csla.Core.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
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.

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 ( Csla.Core.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
System.ArgumentOutOfRangeExceptionWhen property is not defined in AffectedProperties list.


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.

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.

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.

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.

Implemented in Csla.Rules.RuleContext.

◆ GetInputValue< T >() [1/2]

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

Gets the value with explicit cast

Template Parameters
T
Parameters
propertyInfoThe generic property info.
Returns

Implemented in Csla.Rules.RuleContext.

◆ GetInputValue< T >() [2/2]

T Csla.Rules.IRuleContext.GetInputValue< T > ( PropertyInfo< T >  propertyInfo)

Gets the value.

Template Parameters
T
Parameters
propertyInfoThe property info.
Returns

Implemented in Csla.Rules.RuleContext.

◆ TryGetInputValue< T >() [1/2]

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

Implemented in Csla.Rules.RuleContext.

◆ TryGetInputValue< T >() [2/2]

bool Csla.Rules.IRuleContext.TryGetInputValue< 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

Implemented in Csla.Rules.RuleContext.

Property Documentation

◆ ApplicationContext

ApplicationContext Csla.Rules.IRuleContext.ApplicationContext
get

Gets a reference to the current ApplicationContext.

Definition at line 240 of file IRuleContext.cs.

◆ DataPortalFactory

IDataPortalFactory Csla.Rules.IRuleContext.DataPortalFactory
get

Gets a data portal factory instance

Definition at line 244 of file IRuleContext.cs.

◆ DirtyProperties

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

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

The dirty properties.

Definition at line 44 of file IRuleContext.cs.

◆ ExecuteContext

RuleContextModes Csla.Rules.IRuleContext.ExecuteContext
get

Gets the execution context.

The execution context.

Definition at line 236 of file IRuleContext.cs.

◆ InputPropertyValues

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

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

Definition at line 37 of file IRuleContext.cs.

◆ 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.

Definition at line 72 of file IRuleContext.cs.

◆ 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.

Definition at line 93 of file IRuleContext.cs.

◆ 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.

Definition at line 86 of file IRuleContext.cs.

◆ 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.

Definition at line 79 of file IRuleContext.cs.

◆ OriginPropertyName

string Csla.Rules.IRuleContext.OriginPropertyName
get

Gets or sets the name of the origin property.

The name of the origin property.

Definition at line 59 of file IRuleContext.cs.

◆ OutputPropertyValues

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

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

Definition at line 49 of file IRuleContext.cs.

◆ Results

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

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

Definition at line 54 of file IRuleContext.cs.

◆ Rule

IBusinessRuleBase Csla.Rules.IRuleContext.Rule
get

Gets the rule object.

Definition at line 26 of file IRuleContext.cs.

◆ Target

object Csla.Rules.IRuleContext.Target
get

Gets a reference to the target business object.

Definition at line 31 of file IRuleContext.cs.