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/Root.cs
Go to the documentation of this file.
1//-----------------------------------------------------------------------
2// <copyright file="Root.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 Root : BusinessBase<Root>
17 {
18 private static PropertyInfo<string> DataProperty = RegisterProperty<string>(typeof(Root), new PropertyInfo<string>("Data"));
19 public string Data
20 {
21 get { return GetProperty<string>(DataProperty); }
22 set { SetProperty<string>(DataProperty, value); }
23 }
24
25 private static PropertyInfo<Child> ChildProperty = RegisterProperty<Child>(typeof(Root), new PropertyInfo<Child>("Child"));
26 public Child Child
27 {
28 get
29 {
30 return GetProperty(ChildProperty);
31 }
32 }
33
34 private static PropertyInfo<ChildList> ChildListProperty = RegisterProperty<ChildList>(typeof(Root), new PropertyInfo<ChildList>("ChildList"));
36 {
37 get
38 {
39 return GetProperty(ChildListProperty);
40 }
41 }
42
43 public void FetchChild(IChildDataPortal<Child> childDataPortal)
44 {
45 SetProperty(ChildProperty, childDataPortal.FetchChild());
46 }
47
48 [Create]
49 protected void DataPortal_Create([Inject] IChildDataPortal<Child> childDataPortal, [Inject] IChildDataPortal<ChildList> childListDataPortal)
50 {
51 LoadProperty(ChildProperty, childDataPortal.CreateChild());
52 LoadProperty(ChildListProperty, childListDataPortal.CreateChild());
53 }
54
55 [Fetch]
56 protected void DataPortal_Fetch([Inject] IChildDataPortal<Child> childDataPortal, [Inject] IChildDataPortal<ChildList> childListDataPortal)
57 {
58 LoadProperty(ChildProperty, childDataPortal.FetchChild());
59 LoadProperty(ChildListProperty, childListDataPortal.FetchChild());
60 }
61
62 [Insert]
63 protected void DataPortal_Insert()
64 {
65 FieldManager.UpdateChildren(this);
66 }
67
68 [Update]
69 protected void DataPortal_Update()
70 {
71 FieldManager.UpdateChildren(this);
72 }
73 }
74}
This is the base class from which most business objects will be derived.
Definition: BusinessBase.cs:38
Maintains metadata about a property.
void DataPortal_Create([Inject] IChildDataPortal< Child > childDataPortal, [Inject] IChildDataPortal< ChildList > childListDataPortal)
void DataPortal_Fetch([Inject] IChildDataPortal< Child > childDataPortal, [Inject] IChildDataPortal< ChildList > childListDataPortal)
void FetchChild(IChildDataPortal< Child > childDataPortal)
Interface defining the members of the child data portal type.
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.
@ Update
Update operation (includes insert, update and delete self).
@ Fetch
Fetch operation.
@ Create
Create operation.