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.
BrokenRulesMergeRoot.cs
Go to the documentation of this file.
1//-----------------------------------------------------------------------
2// <copyright file="BrokenRulesMergeRoot.cs" company="Marimer LLC">
3// Copyright (c) Marimer LLC. All rights reserved.
4// Website: https://cslanet.com
5// </copyright>
6// <summary>no summary</summary>
7//-----------------------------------------------------------------------
8using System;
9using System.Collections.Generic;
10using System.Text;
11using Csla.Rules;
13
15{
17 public class BrokenRulesMergeRoot : BusinessBase<BrokenRulesMergeRoot>
18 {
19 public static PropertyInfo<string> Test1Property = RegisterProperty<string>(c => c.Test1);
20 public string Test1
21 {
22 get { return GetProperty(Test1Property); }
23 set { SetProperty(Test1Property, value); }
24 }
25
26 public static PropertyInfo<string> Test2Property = RegisterProperty<string>(c => c.Test2);
27 public string Test2
28 {
29 get { return GetProperty(Test2Property); }
30 set { SetProperty(Test2Property, value); }
31 }
32
33 protected override void AddBusinessRules()
34 {
37 }
38
39 public void Validate()
40 {
42 }
43
44 public class RuleBroken : BusinessRule
45 {
46 public RuleBroken(Csla.Core.IPropertyInfo primaryProperty)
47 : base(primaryProperty)
48 { }
49
50 protected override void Execute(IRuleContext context)
51 {
52 context.AddErrorResult("Broken: " + PrimaryProperty.FriendlyName);
53 }
54 }
55
57 {
58 get
59 {
60 var result = new BrokenRulesCollection();
61 result.AddRange(base.BrokenRulesCollection);
62 return result;
63 }
64 }
65
66 [Create]
67 private void Create()
68 {
70 }
71 }
72}
This is the base class from which most business objects will be derived.
Definition: BusinessBase.cs:38
Maintains metadata about a property.
A collection of currently broken rules.
virtual Csla.Core.IPropertyInfo PrimaryProperty
Gets or sets the primary property affected by this rule.
Base class used to create business and validation rules.
Definition: BusinessRule.cs:15
Tracks the business rules for a business object.
List< string > CheckRules()
Invokes all rules for the business type.
void AddRule(IBusinessRuleBase rule)
Associates a business rule with the business object.
RuleBroken(Csla.Core.IPropertyInfo primaryProperty)
override void Execute(IRuleContext context)
Business or validation rule implementation.
override BrokenRulesCollection BrokenRulesCollection
Maintains metadata about a property.
Context information provided to a business rule when it is invoked.
Definition: IRuleContext.cs:22
void AddErrorResult(string description)
Add a Error severity result to the Results list.
@ Serializable
Prevents updating or inserting until the transaction is complete.