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.
RuleArgs.cs
Go to the documentation of this file.
1//-----------------------------------------------------------------------
2// <copyright file="RuleArgs.cs" company="Marimer LLC">
3// Copyright (c) Marimer LLC. All rights reserved.
4// Website: https://cslanet.com
5// </copyright>
6// <summary>Provides the RuleArgs base class for CSLA 3.x rule engine</summary>
7//----------------------------------------------------------------------
8using System;
9using System.Collections.Generic;
10using System.Linq;
11using System.Text;
12using Csla.Rules;
13
14namespace Csla.Validation
15{
20 //[Obsolete("For migration of older apps to Csla 4.x only")]
21 public class RuleArgs
22 {
23 private string _propertyName;
24 private string _propertyFriendlyName;
25 private string _description;
26 private RuleSeverity _severity = RuleSeverity.Error;
27 private bool _stopProcessing;
28
32 public string PropertyName
33 {
34 get { return _propertyName; }
35 }
36
43 {
44 get { return _propertyFriendlyName; }
45 set { _propertyFriendlyName = value; }
46 }
47
58 public string Description
59 {
60 get
61 { return _description; }
62 set { _description = value; }
63 }
64
65
75 {
76 get { return _severity; }
77 set { _severity = value; }
78 }
79
91 public bool StopProcessing
92 {
93 get { return _stopProcessing; }
94 set { _stopProcessing = value; }
95 }
96
97
102 public RuleArgs(string propertyName)
103 {
104
105 _propertyName = propertyName;
106
107 }
108
113 public RuleArgs(Core.IPropertyInfo propertyInfo)
114 : this(propertyInfo.Name)
115 {
116 _propertyFriendlyName = propertyInfo.FriendlyName;
117 }
118
126 public RuleArgs(string propertyName, string friendlyName)
127 : this(propertyName)
128 {
129 _propertyFriendlyName = friendlyName;
130 }
131
150 public RuleArgs(string propertyName, RuleSeverity severity)
151 : this(propertyName)
152 {
153 _severity = severity;
154 }
155
174 public RuleArgs(Core.IPropertyInfo propertyInfo, RuleSeverity severity)
175 : this(propertyInfo)
176 {
177 _severity = severity;
178 }
179
201 public RuleArgs(string propertyName, string friendlyName, RuleSeverity severity)
202 : this(propertyName, friendlyName)
203 {
204 _severity = severity;
205 }
206
229 public RuleArgs(string propertyName, RuleSeverity severity, bool stopProcessing)
230 : this(propertyName, severity)
231 {
232 _stopProcessing = stopProcessing;
233 }
234
257 public RuleArgs(Core.IPropertyInfo propertyInfo, RuleSeverity severity, bool stopProcessing)
258 : this(propertyInfo, severity)
259 {
260 _stopProcessing = stopProcessing;
261 }
262
288 public RuleArgs(string propertyName, string friendlyName, RuleSeverity severity, bool stopProcessing)
289 : this(propertyName, friendlyName, severity)
290 {
291 _stopProcessing = stopProcessing;
292 }
293
297 public override string ToString()
298 {
299 return _propertyName;
300 }
301
313 public static string GetPropertyName(RuleArgs e)
314 {
315 string propName = null;
316
317 if (string.IsNullOrEmpty(e.PropertyFriendlyName))
318 propName = e.PropertyName;
319 else
320 propName = e.PropertyFriendlyName;
321 return propName;
322 }
323 }
324}
Object providing extra information to methods that implement business rules.
Definition: RuleArgs.cs:22
string PropertyFriendlyName
Gets or sets a friendly name for the property, which will be used in place of the property name when ...
Definition: RuleArgs.cs:43
RuleArgs(string propertyName, string friendlyName, RuleSeverity severity, bool stopProcessing)
Creates an instance of RuleArgs.
Definition: RuleArgs.cs:288
RuleArgs(Core.IPropertyInfo propertyInfo, RuleSeverity severity, bool stopProcessing)
Creates an instance of RuleArgs.
Definition: RuleArgs.cs:257
RuleArgs(Core.IPropertyInfo propertyInfo, RuleSeverity severity)
Creates an instance of RuleArgs.
Definition: RuleArgs.cs:174
RuleArgs(string propertyName, string friendlyName)
Creates an instance of RuleArgs.
Definition: RuleArgs.cs:126
RuleArgs(string propertyName, RuleSeverity severity)
Creates an instance of RuleArgs.
Definition: RuleArgs.cs:150
RuleArgs(string propertyName)
Creates an instance of RuleArgs.
Definition: RuleArgs.cs:102
override string ToString()
Returns a string representation of the object.
Definition: RuleArgs.cs:297
string Description
Set by the rule handler method to describe the broken rule.
Definition: RuleArgs.cs:59
RuleSeverity Severity
Gets or sets the severity of the broken rule.
Definition: RuleArgs.cs:75
string PropertyName
The name of the property to be validated.
Definition: RuleArgs.cs:33
RuleArgs(Core.IPropertyInfo propertyInfo)
Creates an instance of RuleArgs.
Definition: RuleArgs.cs:113
static string GetPropertyName(RuleArgs e)
Gets the property name from the RuleArgs object, using the friendly name if one is defined.
Definition: RuleArgs.cs:313
bool StopProcessing
Gets or sets a value indicating whether this broken rule should stop the processing of subsequent rul...
Definition: RuleArgs.cs:92
RuleArgs(string propertyName, string friendlyName, RuleSeverity severity)
Creates an instance of RuleArgs.
Definition: RuleArgs.cs:201
RuleArgs(string propertyName, RuleSeverity severity, bool stopProcessing)
Creates an instance of RuleArgs.
Definition: RuleArgs.cs:229
RuleSeverity
Values for validation rule severities.
Definition: RuleSeverity.cs:16