2using System.Collections.Generic;
5using System.Threading.Tasks;
86 base.PropertyHasChanged(property);
90 #region Validation Rules
95 base.AddBusinessRules();
121 #region Factory Methods
125 return dataPortal.
Create(ruleSet);
149 : base(primaryProperty)
220 : base(primaryProperty)
222 CompareTo = compareToProperty;
223 InputProperties =
new List<IPropertyInfo>() { primaryProperty, compareToProperty };
236 if (value1.CompareTo(value2) >= 0)
248 : base(primaryProperty)
264 await Task.Delay(200);
269 name =
"Rocky Lhotka";
272 name =
string.Format(
"Customer_{0}", customerId);
This is the base class from which most business objects will be derived.
A strongly-typed resource class, for looking up localized strings, etc.
static string StringRequiredRule
Looks up a localized string similar to {0} required.
Maintains metadata about a property.
override bool IsAsync
Gets a value indicating whether the rule will run on a background thread.
virtual Csla.Core.IPropertyInfo PrimaryProperty
Gets or sets the primary property affected by this rule.
object ReadProperty(object obj, Csla.Core.IPropertyInfo propertyInfo)
Reads a property's field value.
List< Csla.Core.IPropertyInfo > InputProperties
Gets a list of secondary property values to be supplied to the rule when it is executed.
List< Csla.Core.IPropertyInfo > AffectedProperties
Gets a list of properties affected by this rule.
Tracks the business rules for a business object.
string?? RuleSet
Gets or sets the rule set to use for this business object instance.
List< string > CheckRules()
Invokes all rules for the business type.
void AddRule(IBusinessRuleBase rule)
Associates a business rule with the business object.
Business rule for a required string.
Base class for object level rules.
Base class for a property rule
bool CanRunOnServer
Gets or sets a value indicating whether this instance can run in logical serverside data portal.
bool CanRunInCheckRules
Gets or sets a value indicating whether this instance can run when CheckRules is called on BO.
bool CanRunAsAffectedProperty
Gets or sets a value indicating whether this instance can run as affected property.
Base class for a property rule
bool CanRunOnServer
Gets or sets a value indicating whether this instance can run in logical serverside data portal.
CalcSum rule will set primary property to the sum of all.
CalcSum(IPropertyInfo primaryProperty, params IPropertyInfo[] inputProperties)
Initializes a new instance of the CalcSum class.
override void Execute(IRuleContext context)
Business or validation rule implementation.
Implements a rule to compare 2 property values and make sure property1 is less than property2
override void Execute(IRuleContext context)
Does the check for primary propert less than compareTo property
LessThan(IPropertyInfo primaryProperty, IPropertyInfo compareToProperty)
Initializes a new instance of the LessThan class.
override async Task ExecuteAsync(IRuleContext context)
Business or validation rule implementation.
IPropertyInfo NameProperty
LookupCustomer(IPropertyInfo primaryProperty, IPropertyInfo nameProperty)
static readonly PropertyInfo< int > Num1Property
override void AddBusinessRules()
static readonly PropertyInfo< string > StateProperty
static readonly PropertyInfo< string > CountryProperty
static readonly PropertyInfo< Csla.SmartDate > EndDateProperty
override void PropertyHasChanged(IPropertyInfo property)
static readonly PropertyInfo< int > CustomerIdProperty
static readonly PropertyInfo< Csla.SmartDate > StartDateProperty
void DataPortal_Create(string ruleSet)
static readonly PropertyInfo< string > NameProperty
static readonly PropertyInfo< int > Num2Property
static readonly PropertyInfo< int > SumProperty
static RuleBaseClassesRoot NewEditableRoot(IDataPortal< RuleBaseClassesRoot > dataPortal, string ruleSet)
override void Execute(IRuleContext context)
Business or validation rule implementation.
Maintains metadata about a property.
string FriendlyName
Gets the friendly display name for the property.
Interface defining the members of the data portal type.
object Create(params object[] criteria)
Called by a factory method in a business class to create a new object, which is loaded with default v...
Context information provided to a business rule when it is invoked.
object Target
Gets a reference to the target business object.
void AddWarningResult(string description)
Add a Warning severity result to the Results list.
void AddErrorResult(string description)
Add a Error 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 c...
void Complete()
Indicates that the rule processing is complete, so CSLA .NET will process the Results list.
void AddSuccessResult(bool stopProcessing)
Add a Success severity result to the Results list.
Dictionary< Csla.Core.IPropertyInfo, object > InputPropertyValues
Gets a dictionary containing copies of property values from the target business object.
void AddInformationResult(string description)
Add an Information severity result to the Results list.
@ CheckObjectRules
Called from CheckObjectRules
@ Serializable
Prevents updating or inserting until the transaction is complete.
Provides a date data type that understands the concept of an empty date value.