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/Async/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;
10using System.Threading.Tasks;
11
13{
15 public class Child : BusinessBase<Child>
16 {
17 public static async Task<Child> NewChildAsync(IChildDataPortal<Child> childDataPortal)
18 {
19 return await childDataPortal.CreateChildAsync();
20 }
21
22 public static async Task<Child> GetChildAsync(IChildDataPortal<Child> childDataPortal)
23 {
24 return await childDataPortal.FetchChildAsync();
25 }
26
27 public Child()
28 {
29 MarkAsChild();
30 }
31
32 private static PropertyInfo<string> DataProperty = RegisterProperty<string>(typeof(Child), new PropertyInfo<string>("Data"));
33 public string Data
34 {
35 get { return GetProperty<string>(DataProperty); }
36 set { SetProperty<string>(DataProperty, value); }
37 }
38
39 private static PropertyInfo<string> RootDataProperty = RegisterProperty<string>(typeof(Child), new PropertyInfo<string>("RootData", string.Empty));
40 public string RootData
41 {
42 get { return GetProperty<string>(RootDataProperty); }
43 set { SetProperty<string>(RootDataProperty, value); }
44 }
45
46 private static PropertyInfo<string> StatusProperty = RegisterProperty<string>(c => c.Status);
47 public string Status
48 {
49 get { return GetProperty(StatusProperty); }
50 }
51
52 [CreateChild]
53 private async Task CreateAsync()
54 {
55 await Task.Delay(5);
56 LoadProperty(StatusProperty, "Created");
57 }
58
59 [FetchChild]
60 private async Task FetchAsync()
61 {
62 await Task.Delay(5);
63 LoadProperty(StatusProperty, "Fetched");
64 }
65
66 [InsertChild]
67 private async Task InsertAsync()
68 {
69 await Task.Delay(5);
70 LoadProperty(StatusProperty, "Inserted");
71 }
72
73 [UpdateChild]
74 private async Task UpdateAsync()
75 {
76 await Task.Delay(5);
77 LoadProperty(StatusProperty, "Updated");
78 }
79
80 [DeleteSelfChild]
81 private async Task DeleteSelfAsync()
82 {
83 await Task.Delay(5);
84 LoadProperty(StatusProperty, "Deleted");
85 }
86 }
87}
This is the base class from which most business objects will be derived.
Definition: BusinessBase.cs:38
Maintains metadata about a property.
static async Task< Child > NewChildAsync(IChildDataPortal< Child > childDataPortal)
static async Task< Child > GetChildAsync(IChildDataPortal< Child > childDataPortal)
Interface defining the members of the child data portal type.
Task< object > FetchChildAsync(params object[] criteria)
Starts an asynchronous data portal operation to create a business object.
Task< object > CreateChildAsync(params object[] criteria)
Starts an asynchronous data portal operation to create a business object.
@ Serializable
Prevents updating or inserting until the transaction is complete.