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.
Csla.test/Basic/GenRootBase.cs
Go to the documentation of this file.
1//-----------------------------------------------------------------------
2// <copyright file="GenRootBase.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;
11
12namespace Csla.Test.Basic
13{
14 [Serializable()]
15 public abstract class GenRootBase : BusinessBase<GenRoot>
16 {
17 private string _data = "";
18
19 protected override object GetIdValue()
20 {
21 return _data;
22 }
23
24 public string Data
25 {
26 get { return _data; }
27 set {
28 if (_data != value)
29 {
30 _data = value;
31 MarkDirty();
32 }
33 }
34 }
35
36 [Serializable()]
37 internal class Criteria : CriteriaBase<Criteria>
38 {
39 public string _data;
40
41 public Criteria()
42 {
43 _data = "<new>";
44 }
45
46 public Criteria(string data)
47 {
48 this._data = data;
49 }
50 }
51
52 private void DataPortal_Create(object criteria)
53 {
54 Criteria crit = (Criteria)(criteria);
55 _data = crit._data;
56 TestResults.Add("GenRoot", "Created");
57 }
58
59 protected void DataPortal_Fetch(object criteria)
60 {
61 Criteria crit = (Criteria)(criteria);
62 _data = crit._data;
63 MarkOld();
64 TestResults.Add("GenRoot", "Fetched");
65 }
66
67 [Update]
68 protected void DataPortal_Update()
69 {
70 if (IsDeleted)
71 {
72 //we would delete here
73 TestResults.Add("GenRoot", "Deleted");
74 MarkNew();
75 }
76 else
77 {
78 if (IsNew)
79 {
80 //we would insert here
81 TestResults.Add("GenRoot", "Inserted");
82 }
83 else
84 {
85 //we would update here
86 TestResults.Add("GenRoot", "Updated");
87 }
88 MarkOld();
89 }
90 }
91
92 [Delete]
93 protected void DataPortal_Delete(object Criteria)
94 {
95 //we would delete here
96 TestResults.Add("GenRoot", "Deleted");
97 }
98 }
99}
override object GetIdValue()
Override this method to return a unique identifying value for this object.
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
@ Serializable
Prevents updating or inserting until the transaction is complete.
@ Update
Update operation (includes insert, update and delete self).
@ Delete
Delete operation.