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.BusinessRuleBase Class Reference

Base class used to create business and validation rules. More...

Inheritance diagram for Csla.Rules.BusinessRuleBase:
Csla.Rules.IBusinessRuleBase Csla.Rules.BusinessRule Csla.Rules.BusinessRuleAsync Csla.Analyzers.IntegrationTests.AsynchronousRuleOldSchool Csla.Analyzers.IntegrationTests.ExecuteWithAdd Csla.Analyzers.IntegrationTests.ExecuteWithAddAndNameof Csla.Analyzers.IntegrationTests.ExecuteWithoutAdd Csla.Rules.CommonRules.DataAnnotation Csla.Rules.CommonRules.Dependency Csla.Rules.CommonRules.InfoMessage Csla.Rules.CommonRules.Lambda Csla.Rules.ObjectRule Csla.Rules.PropertyRule Csla.Test.LogicalExecutionLocation.LocationBusinessBase.CheckRule Csla.Test.ValidationRules.BrokenRulesMergeRoot.RuleBroken Csla.Test.ValidationRules.CheckLazyInputFieldExists Csla.Test.ValidationRules.HasAsyncRule.Rule1 Csla.Test.ValidationRules.HasAsyncRule.Rule2 Csla.Test.ValidationRules.HasAsyncRule.Rule3 Csla.Test.ValidationRules.HasBadSharedRule.BadRule Csla.Test.ValidationRules.HasChildren.OneItem< T > Csla.Test.ValidationRules.HasInvalidAsyncRule.InvalidAsyncValidationRule Csla.Test.ValidationRules.MyRule Csla.Test.ValidationRules.NoErrorRoot.AlwaysInfo Csla.Test.ValidationRules.NoErrorRoot.AlwaysWarns Csla.Test.ValidationRules.SeverityRoot.AlwaysError Csla.Test.ValidationRules.SeverityRoot.AlwaysInfo Csla.Test.ValidationRules.SeverityRoot.AlwaysWarns Csla.Test.ValidationRules.ShortCircuit.AlwaysFails Csla.Test.ValidationRules.ShortCircuit.AlwaysWarns Csla.Test.ValidationRules.TwoProps Csla.Test.ValidationRules.ИзилдрRule Csla.Testing.Business.BusyStatus.ItemWithAsynchRule.FiveSecondsLongRule Csla.Testing.Business.Validation.ИзилдрRule Csla.Analyzers.IntegrationTests.AsynchronousRuleNewSchool Csla.Analyzers.IntegrationTests.CallingComplete Csla.Analyzers.IntegrationTests.CallingCompleteWithNameof Csla.Rules.ObjectRuleAsync Csla.Rules.PropertyRuleAsync Csla.Testing.Business.BusyStatus.ItemWithAsynchRule.TwoSecondsLongRule

Protected Member Functions

void CanWriteProperty (string argument)
 Allows or blocks changing a property value. More...
 
 BusinessRuleBase (Csla.Core.IPropertyInfo primaryProperty)
 Creates an instance of the rule that applies to a specfic property. More...
 
void LoadProperty (object obj, Csla.Core.IPropertyInfo propertyInfo, object newValue)
 Loads a property's managed field with the supplied value calling PropertyHasChanged if the value does change. More...
 
object ReadProperty (object obj, Csla.Core.IPropertyInfo propertyInfo)
 Reads a property's field value. More...
 

Properties

bool PropertiesLocked [getset]
 Gets or sets a value indicating whether property values should be locked because an async operation is running. More...
 
virtual Csla.Core.IPropertyInfo PrimaryProperty [getset]
 Gets or sets the primary property affected by this rule. More...
 
List< Csla.Core.IPropertyInfoAffectedProperties [get]
 Gets a list of properties affected by this rule. More...
 
List< Csla.Core.IPropertyInfoInputProperties [getprotected set]
 Gets a list of secondary property values to be supplied to the rule when it is executed. More...
 
abstract bool IsAsync [getprotected set]
 Gets a value indicating whether the rule will run on a background thread. More...
 
bool ProvideTargetWhenAsync [getprotected set]
 Gets a value indicating that the Target property should be set even for an async rule (note that using Target from a background thread will cause major problems). More...
 
string RuleName [get]
 Gets a unique rule:// URI for the specific instance of the rule within the context of the business object where the rule is used. More...
 
RuleUri RuleUri [getset]
 Sets or gets the rule:// URI object for this rule. More...
 
int Priority [getset]
 Gets the rule priority. More...
 
RunModes RunMode [getset]
 Gets or sets the run in context. More...
 
- Properties inherited from Csla.Rules.IBusinessRuleBase
List< Csla.Core.IPropertyInfoInputProperties [get]
 Gets a list of secondary property values to be supplied to the rule when it is executed. More...
 
List< Csla.Core.IPropertyInfoAffectedProperties [get]
 Gets a list of properties affected by this rule. More...
 
Csla.Core.IPropertyInfo PrimaryProperty [get]
 Gets the primary property affected by this rule. More...
 
string RuleName [get]
 Gets a unique rule:// URI for the specific instance of the rule within the context of the business object where the rule is used. More...
 
int Priority [get]
 Gets the rule priority. More...
 
bool ProvideTargetWhenAsync [get]
 Gets a value indicating that the Target property should be set even for an async rule (note that using Target from a background thread will cause major problems). More...
 
RunModes RunMode [get]
 Gets the context in which the rule is allowed to execute. More...
 
bool IsAsync [get]
 Gets a value indicating whether the Execute() method will run asynchronous code. More...
 

Detailed Description

Base class used to create business and validation rules.

Definition at line 18 of file BusinessRuleBase.cs.

Constructor & Destructor Documentation

◆ BusinessRuleBase()

Csla.Rules.BusinessRuleBase.BusinessRuleBase ( Csla.Core.IPropertyInfo  primaryProperty)
protected

Creates an instance of the rule that applies to a specfic property.

Parameters
primaryPropertyPrimary property for this rule.

Definition at line 145 of file BusinessRuleBase.cs.

Member Function Documentation

◆ CanWriteProperty()

void Csla.Rules.BusinessRuleBase.CanWriteProperty ( string  argument)
protected

Allows or blocks changing a property value.

Parameters
argument

Definition at line 134 of file BusinessRuleBase.cs.

◆ LoadProperty()

void Csla.Rules.BusinessRuleBase.LoadProperty ( object  obj,
Csla.Core.IPropertyInfo  propertyInfo,
object  newValue 
)
protected

Loads a property's managed field with the supplied value calling PropertyHasChanged if the value does change.

Parameters
objObject on which to call the method.
propertyInfoPropertyInfo object containing property metadata.
newValueThe new value for the property.

No authorization checks occur when this method is called, and no PropertyChanging or PropertyChanged events are raised. Loading values does not cause validation rules to be invoked.

Definition at line 172 of file BusinessRuleBase.cs.

◆ ReadProperty()

object Csla.Rules.BusinessRuleBase.ReadProperty ( object  obj,
Csla.Core.IPropertyInfo  propertyInfo 
)
protected

Reads a property's field value.

Parameters
objObject on which to call the method.
propertyInfoPropertyInfo object containing property metadata.

No authorization checks occur when this method is called.

Definition at line 191 of file BusinessRuleBase.cs.

Property Documentation

◆ AffectedProperties

List<Csla.Core.IPropertyInfo> Csla.Rules.BusinessRuleBase.AffectedProperties
get

Gets a list of properties affected by this rule.

Rules for these properties are executed after rules for the primary property.

Definition at line 54 of file BusinessRuleBase.cs.

◆ InputProperties

List<Csla.Core.IPropertyInfo> Csla.Rules.BusinessRuleBase.InputProperties
getprotected set

Gets a list of secondary property values to be supplied to the rule when it is executed.

Definition at line 60 of file BusinessRuleBase.cs.

◆ IsAsync

abstract bool Csla.Rules.BusinessRuleBase.IsAsync
getprotected set

Gets a value indicating whether the rule will run on a background thread.

Definition at line 66 of file BusinessRuleBase.cs.

◆ PrimaryProperty

virtual Csla.Core.IPropertyInfo Csla.Rules.BusinessRuleBase.PrimaryProperty
getset

Gets or sets the primary property affected by this rule.

Definition at line 36 of file BusinessRuleBase.cs.

◆ Priority

int Csla.Rules.BusinessRuleBase.Priority
getset

Gets the rule priority.

Definition at line 106 of file BusinessRuleBase.cs.

◆ PropertiesLocked

bool Csla.Rules.BusinessRuleBase.PropertiesLocked
getsetprotected

Gets or sets a value indicating whether property values should be locked because an async operation is running.

Definition at line 31 of file BusinessRuleBase.cs.

◆ ProvideTargetWhenAsync

bool Csla.Rules.BusinessRuleBase.ProvideTargetWhenAsync
getprotected set

Gets a value indicating that the Target property should be set even for an async rule (note that using Target from a background thread will cause major problems).

Definition at line 73 of file BusinessRuleBase.cs.

◆ RuleName

string Csla.Rules.BusinessRuleBase.RuleName
get

Gets a unique rule:// URI for the specific instance of the rule within the context of the business object where the rule is used.

Definition at line 88 of file BusinessRuleBase.cs.

◆ RuleUri

RuleUri Csla.Rules.BusinessRuleBase.RuleUri
getsetprotected

Sets or gets the rule:// URI object for this rule.

Definition at line 93 of file BusinessRuleBase.cs.

◆ RunMode

RunModes Csla.Rules.BusinessRuleBase.RunMode
getset

Gets or sets the run in context.

The run in context.

Definition at line 120 of file BusinessRuleBase.cs.