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.
ListObject.cs
Go to the documentation of this file.
1//-----------------------------------------------------------------------
2// <copyright file="ListObject.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.Core;
12using Csla;
13
14namespace DataBindingApp
15{
16 [Serializable()]
17 public class ListObject : BusinessListBase<ListObject, ListObject.DataObject>
18 {
19 [Serializable()]
20 public class DataObject : BusinessBase<DataObject>
21 {
22 private int _ID;
23 private string _data;
24 private int _number;
25
26 public int Number
27 {
28 get { return _number; }
29 set { _number = value; }
30 }
31
32 public string Data
33 {
34 get { return _data; }
35 set { _data = value; }
36 }
37
38 public int ID
39 {
40 get { return _ID; }
41 set { _ID = value; }
42 }
43
44 protected override object GetIdValue()
45 {
46 return _number;
47 }
48
49 public DataObject(string data, int number)
50 {
51 this.MarkAsChild();
52 _data = data;
53 _number = number;
54 this.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(DataObject_PropertyChanged);
55 }
56
57 public void DataObject_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
58 {
59 Console.WriteLine("Property has changed");
60 }
61 }
62
63 private ListObject()
64 { }
65
66 public static ListObject GetList()
67 {
68 ListObject list = new ListObject();
69
70 for (int i = 0; i < 5; i++)
71 {
72 list.Add(new DataObject("element" + i, i));
73 }
74
75 return list;
76 }
77
78
79 }
80}
This is the base class from which most business objects will be derived.
Definition: BusinessBase.cs:38
This is the base class from which most business collections or lists will be derived.
void MarkAsChild()
Marks the object as being a child object.
override object GetIdValue()
Override this method to return a unique identifying value for this object.
Definition: ListObject.cs:44
DataObject(string data, int number)
Definition: ListObject.cs:49
void DataObject_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
Definition: ListObject.cs:57
static ListObject GetList()
Definition: ListObject.cs:66
@ Serializable
Prevents updating or inserting until the transaction is complete.