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/FieldManager/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//-----------------------------------------------------------------------
8
9using System;
10
12{
14 public class Child : BusinessBase<Child>
15 {
16 public static Child NewChild(IChildDataPortal<Child> childDataPortal)
17 {
18 return childDataPortal.CreateChild();
19 }
20
21 public static Child GetChild(IChildDataPortal<Child> childDataPortal)
22 {
23 return childDataPortal.FetchChild();
24 }
25
26 public Child()
27 {
28 MarkAsChild();
29 }
30
31 private static PropertyInfo<string> DataProperty = RegisterProperty<string>(typeof(Child), new PropertyInfo<string>("Data"));
32 public string Data
33 {
34 get { return GetProperty<string>(DataProperty); }
35 set { SetProperty<string>(DataProperty, value); }
36 }
37
38 private static PropertyInfo<string> RootDataProperty = RegisterProperty<string>(typeof(Child), new PropertyInfo<string>("RootData", string.Empty));
39 public string RootData
40 {
41 get { return GetProperty<string>(RootDataProperty); }
42 set { SetProperty<string>(RootDataProperty, value); }
43 }
44
45 private static PropertyInfo<string> StatusProperty = RegisterProperty<string>(c => c.Status);
46 public string Status
47 {
48 get { return GetProperty(StatusProperty); }
49 }
50
51 public void DeleteChild()
52 {
53 MarkDeleted();
54 }
55
56 protected override void Child_Create()
57 {
58 LoadProperty(StatusProperty, "Created");
59 }
60
61 [FetchChild]
62 protected void Child_Fetch()
63 {
64 LoadProperty(StatusProperty, "Fetched");
65 }
66
67 [InsertChild]
68 protected void Child_Insert()
69 {
70 LoadProperty(StatusProperty, "Inserted");
71 }
72
73 [UpdateChild]
74 protected void Child_Update()
75 {
76 LoadProperty(StatusProperty, "Updated");
77 }
78
79 [DeleteSelfChild]
80 protected void Child_DeleteSelf()
81 {
82 LoadProperty(StatusProperty, "Deleted");
83 }
84 }
85}
This is the base class from which most business objects will be derived.
Definition: BusinessBase.cs:38
Maintains metadata about a property.
static Child GetChild(IChildDataPortal< Child > childDataPortal)
static Child NewChild(IChildDataPortal< Child > childDataPortal)
Interface defining the members of the child data portal type.
object CreateChild(params object[] criteria)
Called by a factory method in a business class to create a new object, which is loaded with default v...
object FetchChild(params object[] criteria)
Called by a factory method in a business class to retrieve an object, which is loaded with values fro...
@ Serializable
Prevents updating or inserting until the transaction is complete.