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/GrandChild.cs
Go to the documentation of this file.
1//-----------------------------------------------------------------------
2// <copyright file="GrandChild.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 System.Data;
12
13namespace Csla.Test.Basic
14{
15 [Serializable()]
16 public class GrandChild : BusinessBase<GrandChild>
17 {
18 private string _data = "";
19
20 protected override object GetIdValue()
21 {
22 return _data;
23 }
24
25 public string Data
26 {
27 get { return _data; }
28 set
29 {
30 if (_data != value)
31 {
32 _data = value;
33 MarkDirty();
34 }
35 }
36 }
37
38 internal static GrandChild NewGrandChild(string data)
39 {
40 GrandChild obj = new GrandChild();
41 obj._data = data;
42 return obj;
43 }
44
45 internal static GrandChild GetGrandChild(IDataReader dr)
46 {
47 GrandChild obj = new GrandChild();
48 obj.Fetch(dr);
49 return obj;
50 }
51
52 public GrandChild()
53 {
54 MarkAsChild();
55 }
56
57 private void Fetch(IDataReader dr)
58 {
59 MarkOld();
60 }
61
62 internal void Update(IDbTransaction tr)
63 {
64 if (IsDeleted)
65 {
66 //we would delete here
67 MarkNew();
68 }
69 else
70 {
71 if (IsNew)
72 {
73 //we would insert here
74 }
75 else
76 {
77 //we would update here
78 }
79 MarkOld();
80 }
81 }
82
83 protected override void OnDeserialized(System.Runtime.Serialization.StreamingContext context)
84 {
85 base.OnDeserialized(context);
86 TestResults.Add("GCDeserialized", "GC Deserialized");
87 }
88 }
89}
override void OnDeserialized(System.Runtime.Serialization.StreamingContext context)
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.