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.netcore.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 public static readonly PropertyInfo<string> DataProperty = RegisterProperty<string>(c => c.Data);
19 public string Data
20 {
21 get { return GetProperty(DataProperty); }
22 set { SetProperty(DataProperty, value); }
23 }
24
25 internal static GrandChild NewGrandChild(string data)
26 {
27 GrandChild obj = new GrandChild();
28 obj.Data = data;
29 return obj;
30 }
31
32 internal static GrandChild GetGrandChild(IDataReader dr)
33 {
34 GrandChild obj = new GrandChild();
35 obj.Fetch(dr);
36 return obj;
37 }
38
39 public GrandChild()
40 {
41 MarkAsChild();
42 }
43
44 private void Fetch(IDataReader dr)
45 {
46 MarkOld();
47 }
48
49 internal void Update(IDbTransaction tr)
50 {
51 if (IsDeleted)
52 {
53 //we would delete here
54 MarkNew();
55 }
56 else
57 {
58 if (IsNew)
59 {
60 //we would insert here
61 }
62 else
63 {
64 //we would update here
65 }
66 MarkOld();
67 }
68 }
69
70 protected override void OnDeserialized(System.Runtime.Serialization.StreamingContext context)
71 {
72 base.OnDeserialized(context);
73 TestResults.Add("GCDeserialized", "GC Deserialized");
74 }
75 }
76}
This is the base class from which most business objects will be derived.
Definition: BusinessBase.cs:38
Maintains metadata about a property.
override void OnDeserialized(System.Runtime.Serialization.StreamingContext context)
static readonly PropertyInfo< string > DataProperty
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.