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.
HasInvalidAsyncRule.cs
Go to the documentation of this file.
1//-----------------------------------------------------------------------
2// <copyright file="HasInvalidAsyncRule.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.Linq;
11using System.Text;
12using Csla.Rules;
13using System.ComponentModel;
14using System.Threading;
15
17{
18#if TESTING
19 [System.Diagnostics.DebuggerStepThrough]
20#endif
21 public partial class HasInvalidAsyncRule : BusinessBase<HasInvalidAsyncRule>
22 {
23 public static PropertyInfo<string> NameProperty = RegisterProperty<string>(c => c.Name);
24 public string Name
25 {
26 get { return GetProperty(NameProperty); }
27 set { SetProperty(NameProperty, value); }
28 }
29
30 protected override void AddBusinessRules()
31 {
33 base.AddBusinessRules();
34 }
35
36 public new Rules.BrokenRulesCollection GetBrokenRules()
37 {
39 }
40
41 public void Validate()
42 {
44 }
45
47 {
49 : base(primaryProperty)
50 {
51 IsAsync = true;
52 InputProperties = new List<Core.IPropertyInfo> { primaryProperty };
53 }
54
55 protected override void Execute(IRuleContext context)
56 {
57 var bw = new System.ComponentModel.BackgroundWorker();
58 bw.DoWork += (o, e) =>
59 {
60 throw new InvalidOperationException();
61 };
62 bw.RunWorkerCompleted += (o, e) =>
63 {
64 if (e.Error != null)
65 context.AddErrorResult(e.Error.Message);
66 context.Complete();
67 };
68 bw.RunWorkerAsync();
69 }
70 }
71
72 [Create]
73 private void Create()
74 {
75 }
76 }
77}
This is the base class from which most business objects will be derived.
Definition: BusinessBase.cs:38
Maintains metadata about a property.
List< Csla.Core.IPropertyInfo > InputProperties
Gets a list of secondary property values to be supplied to the rule when it is executed.
Base class used to create business and validation rules.
Definition: BusinessRule.cs:15
override bool IsAsync
Gets a value indicating whether the rule will run on a background thread.
Definition: BusinessRule.cs:23
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.
BrokenRulesCollection GetBrokenRules()
Gets the broken rules list.
override void Execute(IRuleContext context)
Business or validation rule implementation.
new Rules.BrokenRulesCollection GetBrokenRules()
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.
void Complete()
Indicates that the rule processing is complete, so CSLA .NET will process the Results list.