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.
SingleChild.cs
Go to the documentation of this file.
1//-----------------------------------------------------------------------
2// <copyright file="SingleChild.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.Linq;
11using System.Text;
12using Csla;
14
16{
18 public class SingleChild : BusinessBase<SingleChild>
19 {
20 public SingleChild()
21 { }
22
23 public SingleChild(bool child)
24 {
25 if (child)
26 MarkAsChild();
27 }
28
29 private static PropertyInfo<string> NameProperty = RegisterProperty(new PropertyInfo<string>("Name"));
30 public string Name
31 {
32 get { return GetProperty(NameProperty); }
33 set { SetProperty(NameProperty, value); }
34 }
35
36 private static PropertyInfo<SingleRoot> ChildProperty = RegisterProperty(new PropertyInfo<SingleRoot>("Child"));
38 {
39 get
40 {
41 return GetProperty(ChildProperty);
42 }
43 }
44
45 [Fetch]
46 [FetchChild]
47 private void Fetch(bool child, [Inject] IChildDataPortal<SingleRoot> childDataPortal)
48 {
49 LoadProperty(ChildProperty, childDataPortal.FetchChild(true));
50 if (child)
51 MarkAsChild();
52 }
53 }
54}
This is the base class from which most business objects will be derived.
Definition: BusinessBase.cs:38
Maintains metadata about a property.
Interface defining the members of the child data portal type.
@ Serializable
Prevents updating or inserting until the transaction is complete.