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.
RuleResult.cs
Go to the documentation of this file.
1//-----------------------------------------------------------------------
2// <copyright file="RuleResult.cs" company="Marimer LLC">
3// Copyright (c) Marimer LLC. All rights reserved.
4// Website: https://cslanet.com
5// </copyright>
6// <summary>Contains information about the result of a rule.</summary>
7//-----------------------------------------------------------------------
8using System;
9using System.Collections.Generic;
10using System.Linq;
11using System.Text;
12using Csla.Properties;
13
14namespace Csla.Rules
15{
19 public class RuleResult
20 {
25 public string RuleName { get; private set; }
30 public bool Success { get; private set; }
35 public string Description { get; private set; }
39 public RuleSeverity Severity { get; set; }
45 public bool StopProcessing { get; set; }
49 public Csla.Core.IPropertyInfo PrimaryProperty { get; private set; }
55 public List<Core.IPropertyInfo> Properties { get; set; }
61 public Dictionary<Core.IPropertyInfo, object> OutputPropertyValues { get; set; }
62
70 public RuleResult(string ruleName, Core.IPropertyInfo property)
71 {
72 RuleName = ruleName;
73 PrimaryProperty = property;
74 Success = true;
75 Severity = RuleSeverity.Success;
76 }
77
87 public RuleResult(string ruleName, Core.IPropertyInfo property, string description)
88 {
89
90 if (string.IsNullOrEmpty(description))
91 throw new ArgumentException(string.Format(Resources.RuleMessageRequired, ruleName), "description");
92
93 RuleName = ruleName;
94 PrimaryProperty = property;
95 Description = description;
96 Success = string.IsNullOrEmpty(description);
97 Severity = RuleSeverity.Error;
98 }
99 }
100}
A strongly-typed resource class, for looking up localized strings, etc.
static string RuleMessageRequired
Looks up a localized string similar to Message for broken rule is required.
Contains information about the result of a rule.
Definition: RuleResult.cs:20
List< Core.IPropertyInfo > Properties
Gets or sets a list of properties that were affected by the rule, so appropriate PropertyChanged even...
Definition: RuleResult.cs:55
RuleSeverity Severity
Gets or sets the severity of a failed rule.
Definition: RuleResult.cs:39
string Description
Gets a human-readable description of why the rule failed.
Definition: RuleResult.cs:35
RuleResult(string ruleName, Core.IPropertyInfo property)
Creates a successful result.
Definition: RuleResult.cs:70
Csla.Core.IPropertyInfo PrimaryProperty
Gets the primary property for this result.
Definition: RuleResult.cs:49
Dictionary< Core.IPropertyInfo, object > OutputPropertyValues
Gets or sets a dictionary of new property values used to update the business object's properties afte...
Definition: RuleResult.cs:61
bool Success
Gets a value indicating whether the rule was successful.
Definition: RuleResult.cs:30
string RuleName
Gets the unique name of the rule that created this result.
Definition: RuleResult.cs:25
RuleResult(string ruleName, Core.IPropertyInfo property, string description)
Creates a failure result.
Definition: RuleResult.cs:87
bool StopProcessing
Gets or sets a value indicating whether rule processing should immediately stop (applies to sync rule...
Definition: RuleResult.cs:45
Maintains metadata about a property.
RuleSeverity
Values for validation rule severities.
Definition: RuleSeverity.cs:16