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.
HasRulesManager2.partial.cs
Go to the documentation of this file.
1//-----------------------------------------------------------------------
2// <copyright file="HasRulesManager2.partial.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;
12
14{
15 public partial class HasRulesManager2
16 {
17 [Create]
18 private void DataPortal_Create()
19 {
20 BusinessRules.CheckRules();
21 }
22
23 [Create]
24 private void DataPortal_Create(object criteria)
25 {
26 Criteria crit = (Criteria)(criteria);
27 using (BypassPropertyChecks)
28 Name = crit._name;
29 TestResults.Add("HasRulesManager2", "Created");
30 BusinessRules.CheckRules();
31 }
32
33 protected void DataPortal_Fetch(object criteria)
34 {
35 Criteria crit = (Criteria)(criteria);
36 using (BypassPropertyChecks)
37 Name = crit._name;
38 MarkOld();
39 TestResults.Add("HasRulesManager2", "Fetched");
40 }
41
42 [Update]
43 protected void DataPortal_Update()
44 {
45 if (IsDeleted)
46 {
47 //we would delete here
48 TestResults.Add("HasRulesManager2", "Deleted");
49 MarkNew();
50 }
51 else
52 {
53 if (this.IsNew)
54 {
55 //we would insert here
56 TestResults.Add("HasRulesManager2", "Inserted");
57 }
58 else
59 {
60 //we would update here
61 TestResults.Add("HasRulesManager2", "Updated");
62 }
63 MarkOld();
64 }
65 }
66
67 [Delete]
68 protected void DataPortal_Delete(object criteria)
69 {
70 //we would delete here
71 TestResults.Add("HasRulesManager2", "Deleted");
72 }
73
74
75 }
76}
Static dictionary-like class that offers similar functionality to GlobalContext This is used in tests...
Definition: TestResults.cs:21
static void Add(string key, string value)
Add an item to the test results, to indicate an outcome of a particular operation
Definition: TestResults.cs:29
@ Update
Update operation (includes insert, update and delete self).
@ Create
Create operation.
@ Delete
Delete operation.