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/DataPortalChild/Child.cs
Go to the documentation of this file.
1//-----------------------------------------------------------------------
2// <copyright file="Child.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 Csla;
12
14{
16 public class Child : BusinessBase<Child>
17 {
18 public Child()
19 {
20 MarkAsChild();
21 }
22
23 private static PropertyInfo<string> DataProperty = RegisterProperty<string>(typeof(Child), new PropertyInfo<string>("Data"));
24 public string Data
25 {
26 get { return GetProperty<string>(DataProperty); }
27 set { SetProperty<string>(DataProperty, value); }
28 }
29
30 private static PropertyInfo<string> RootDataProperty = RegisterProperty<string>(typeof(Child), new PropertyInfo<string>("RootData", string.Empty));
31 public string RootData
32 {
33 get { return GetProperty<string>(RootDataProperty); }
34 set { SetProperty<string>(RootDataProperty, value); }
35 }
36
37 private static PropertyInfo<string> StatusProperty = RegisterProperty<string>(c => c.Status);
38 public string Status
39 {
40 get { return GetProperty(StatusProperty); }
41 private set { SetProperty(StatusProperty, value); }
42 }
43
44 public void DeleteChild()
45 {
46 base.MarkDeleted();
47 }
48
49 [CreateChild]
50 protected override void Child_Create()
51 {
52 LoadProperty(StatusProperty, "Created");
53 }
54
55 [FetchChild]
56 protected void Child_Fetch()
57 {
58 LoadProperty(StatusProperty, "Fetched");
59 }
60
61 [InsertChild]
62 protected void Child_Insert(Root parent)
63 {
64 LoadProperty(StatusProperty, "Inserted");
65 if (this.Parent is ChildList)
66 {
67 LoadProperty(RootDataProperty, ((Root)((ChildList)this.Parent).MyParent).Data);
68 }
69 else
70 {
71 LoadProperty(RootDataProperty, ((Root)this.Parent).Data);
72 }
73 }
74
75 [UpdateChild]
76 protected void Child_Update(Root parent)
77 {
78 LoadProperty(StatusProperty, "Updated");
79 if (this.Parent is ChildList)
80 {
81 LoadProperty(RootDataProperty, ((Root)((ChildList)this.Parent).MyParent).Data);
82 }
83 else
84 {
85 LoadProperty(RootDataProperty, ((Root)this.Parent).Data);
86 }
87 }
88
89 [DeleteSelfChild]
90 protected void Child_DeleteSelf()
91 {
92 LoadProperty(StatusProperty, "Deleted");
93 }
94 }
95}
This is the base class from which most business objects will be derived.
Definition: BusinessBase.cs:38
Maintains metadata about a property.
@ Serializable
Prevents updating or inserting until the transaction is complete.