CSLA.NET 5.4.2
CSLA .NET is a software development framework that helps you build a reusable, maintainable object-oriented business layer for your app.
ObjectRuleAsync.cs
Go to the documentation of this file.
1//-----------------------------------------------------------------------
2// <copyright file="ObjectRuleAsync.cs" company="Marimer LLC">
3// Copyright (c) Marimer LLC. All rights reserved.
4// Website: https://cslanet.com
5// </copyright>
6// <summary>Base class used to create object level rule</summary>
7//-----------------------------------------------------------------------
8using System;
9using Csla.Core;
10using Csla.Properties;
11
12namespace Csla.Rules
13{
17 public abstract class ObjectRuleAsync : BusinessRuleAsync
18 {
22 protected ObjectRuleAsync()
23 { }
24
31 {
32 get
33 {
34 return null;
35 }
36 set
37 {
38 if (value != null)
39 {
40 throw new ArgumentException(Resources.ObjectRulesCannotSetPrimaryProperty, "PrimaryProperty");
41 }
42 }
43 }
44
52 {
53 get { return (RunMode & RunModes.DenyCheckRules) == 0; }
54 set
55 {
56 if (value && !CanRunInCheckRules)
57 {
58 RunMode = RunMode ^ RunModes.DenyCheckRules;
59 }
60 else if (!value && CanRunInCheckRules)
61 {
62 RunMode = RunMode | RunModes.DenyCheckRules;
63 }
64 }
65 }
66 }
67}
A strongly-typed resource class, for looking up localized strings, etc.
static string ObjectRulesCannotSetPrimaryProperty
Looks up a localized string similar to Object rule can not have PrimaryPropery.
Base class used to create async business and validation rules.
RunModes RunMode
Gets or sets the run in context.
Base class for object level rules.
ObjectRuleAsync()
Initializes a new instance of the ObjectRule class.
bool CanRunInCheckRules
Gets or sets a value indicating whether this instance can run when CheckRules is called on BO.
override IPropertyInfo PrimaryProperty
Gets or sets the primary property affected by this rule.
Maintains metadata about a property.
RunModes
Flags enum to define when rule is allowed or denied to run