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.
BinaryReaderWriterTestClass.cs
Go to the documentation of this file.
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
6using Csla.Core;
7using Csla;
8
10{
11 public enum RandomEnum
12 {
13 None = 0,
14 Value1 = 1,
15 Value2 = 2
16 }
17
19 public class BinaryReaderWriterTestClassList : BusinessListBase<BinaryReaderWriterTestClassList, BinaryReaderWriterTestClass>
20 {
22 {
23
24 }
25
26 public void Setup()
27 {
28 }
29
31 {
32 return dataPortal.Create();
33 }
34
35 [Create]
36 private void Create([Inject] IDataPortal<BinaryReaderWriterTestClass> childDataPortal)
37 {
38 Add(BinaryReaderWriterTestClass.NewBinaryReaderWriterTestClass(childDataPortal, true));
39 Add(BinaryReaderWriterTestClass.NewBinaryReaderWriterTestClass(childDataPortal, true));
40 this[0].Setup();
41 this[1].Setup();
42 this[1].StringTest = "random";
43 }
44 }
45
47 public class BinaryReaderWriterTestClass : BusinessBase<BinaryReaderWriterTestClass>
48 {
49
51 {
52
53 }
54
55 public BinaryReaderWriterTestClass(bool isChild)
56 {
57 if (isChild)
58 MarkAsChild();
59 }
60
61 public void Setup()
62 {
63 this.BoolTest = true;
64 this.ByteArrayTest = new byte[] { 1, 2, 3, 4 };
65 this.ByteTest = 3;
66 this.CharArrayTest = "abc".ToArray();
67 this.CharTest = "a".ToArray()[0];
68 this.DateTimeOffsetTest = new DateTimeOffset(new DateTime(2001, 1, 2, 3, 4, 5, 6), new TimeSpan(0, 1, 0, 0));
69 this.DateTimeTest = new DateTime(2000, 1, 2, 3, 4, 5, 6);
70 this.DecimalTest = 1.2m;
71 this.DoubleTest = 123.45567;
72 this.GuidTest = Guid.NewGuid();
73 this.Int16Test = 1;
74 this.Int32Test = 2;
75 this.Int64Test = 3;
76 this.SByteTest = 4;
77 this.SingleTest = (Single)12.3;
78 this.StringTest = "abcd";
79 this.TimeSpanTest = new TimeSpan(2, 3, 4, 5, 7);
80 this.UInt16Test = 11;
81 this.UInt32Test = 22;
82 this.UInt64Test = 33;
83 this.EnumTest = RandomEnum.Value1;
84 this.NullableInt = null;
85 this.NullableButSetInt = 22;
86 this.EmptySmartDateTest = new Csla.SmartDate(false);
87 this.FilledSmartDateTest = new Csla.SmartDate(new DateTime(2001, 1, 1), true) { FormatString = "yyyy/MM/dd" };
88 }
89
90 public static readonly PropertyInfo<RandomEnum> EnumTestProperty = RegisterProperty<RandomEnum>(c => c.EnumTest);
95 {
96 get { return GetProperty(EnumTestProperty); }
97 set { SetProperty(EnumTestProperty, value); }
98 }
99
100 public static readonly PropertyInfo<bool> BoolTestProperty = RegisterProperty<bool>(c => c.BoolTest);
104 public bool BoolTest
105 {
106 get { return GetProperty(BoolTestProperty); }
107 set { SetProperty(BoolTestProperty, value); }
108 }
109
110 public static readonly PropertyInfo<char> CharTestProperty = RegisterProperty<char>(c => c.CharTest);
114 public char CharTest
115 {
116 get { return GetProperty(CharTestProperty); }
117 set { SetProperty(CharTestProperty, value); }
118 }
119
120 public static readonly PropertyInfo<SByte> SByteTestProperty = RegisterProperty<SByte>(c => c.SByteTest);
124 public SByte SByteTest
125 {
126 get { return GetProperty(SByteTestProperty); }
127 set { SetProperty(SByteTestProperty, value); }
128 }
129
130 public static readonly PropertyInfo<byte> ByteTestProperty = RegisterProperty<byte>(c => c.ByteTest);
134 public byte ByteTest
135 {
136 get { return GetProperty(ByteTestProperty); }
137 set { SetProperty(ByteTestProperty, value); }
138 }
139
140 public static readonly PropertyInfo<Int16> Int16TestProperty = RegisterProperty<Int16>(c => c.Int16Test);
144 public Int16 Int16Test
145 {
146 get { return GetProperty(Int16TestProperty); }
147 set { SetProperty(Int16TestProperty, value); }
148 }
149
150 public static readonly PropertyInfo<UInt16> UInt16TestProperty = RegisterProperty<UInt16>(c => c.UInt16Test);
154 public UInt16 UInt16Test
155 {
156 get { return GetProperty(UInt16TestProperty); }
157 set { SetProperty(UInt16TestProperty, value); }
158 }
159
160 public static readonly PropertyInfo<Int32> Int32TestProperty = RegisterProperty<Int32>(c => c.Int32Test);
164 public Int32 Int32Test
165 {
166 get { return GetProperty(Int32TestProperty); }
167 set { SetProperty(Int32TestProperty, value); }
168 }
169
170 public static readonly PropertyInfo<UInt32> UInt32TestProperty = RegisterProperty<UInt32>(c => c.UInt32Test);
174 public UInt32 UInt32Test
175 {
176 get { return GetProperty(UInt32TestProperty); }
177 set { SetProperty(UInt32TestProperty, value); }
178 }
179
180 public static readonly PropertyInfo<Int64> Int64TestProperty = RegisterProperty<Int64>(c => c.Int64Test);
184 public Int64 Int64Test
185 {
186 get { return GetProperty(Int64TestProperty); }
187 set { SetProperty(Int64TestProperty, value); }
188 }
189
190 public static readonly PropertyInfo<UInt64> UInt64TestProperty = RegisterProperty<UInt64>(c => c.UInt64Test);
194 public UInt64 UInt64Test
195 {
196 get { return GetProperty(UInt64TestProperty); }
197 set { SetProperty(UInt64TestProperty, value); }
198 }
199
200 public static readonly PropertyInfo<Single> SingleTestProperty = RegisterProperty<Single>(c => c.SingleTest);
205 {
206 get { return GetProperty(SingleTestProperty); }
207 set { SetProperty(SingleTestProperty, value); }
208 }
209
210 public static readonly PropertyInfo<double> DoubleTestProperty = RegisterProperty<double>(c => c.DoubleTest);
214 public double DoubleTest
215 {
216 get { return GetProperty(DoubleTestProperty); }
217 set { SetProperty(DoubleTestProperty, value); }
218 }
219
220 public static readonly PropertyInfo<decimal> DecimalTestProperty = RegisterProperty<decimal>(c => c.DecimalTest);
224 public decimal DecimalTest
225 {
226 get { return GetProperty(DecimalTestProperty); }
227 set { SetProperty(DecimalTestProperty, value); }
228 }
229
230 public static readonly PropertyInfo<DateTime> DateTimeTestProperty = RegisterProperty<DateTime>(c => c.DateTimeTest);
234 public DateTime DateTimeTest
235 {
236 get { return GetProperty(DateTimeTestProperty); }
237 set { SetProperty(DateTimeTestProperty, value); }
238 }
239
240 public static readonly PropertyInfo<string> StringTestProperty = RegisterProperty<string>(c => c.StringTest);
244 public string StringTest
245 {
246 get { return GetProperty(StringTestProperty); }
247 set { SetProperty(StringTestProperty, value); }
248 }
249
250 public static readonly PropertyInfo<TimeSpan> TimeSpanTestProperty = RegisterProperty<TimeSpan>(c => c.TimeSpanTest);
254 public TimeSpan TimeSpanTest
255 {
256 get { return GetProperty(TimeSpanTestProperty); }
257 set { SetProperty(TimeSpanTestProperty, value); }
258 }
259
260 public static readonly PropertyInfo<DateTimeOffset> DateTimeOffsetTestProperty = RegisterProperty<DateTimeOffset>(c => c.DateTimeOffsetTest);
264 public DateTimeOffset DateTimeOffsetTest
265 {
266 get { return GetProperty(DateTimeOffsetTestProperty); }
267 set { SetProperty(DateTimeOffsetTestProperty, value); }
268 }
269
270 public static readonly PropertyInfo<byte[]> ByteArrayTestProperty = RegisterProperty<byte[]>(c => c.ByteArrayTest);
274 public byte[] ByteArrayTest
275 {
276 get { return GetProperty(ByteArrayTestProperty); }
277 set { SetProperty(ByteArrayTestProperty, value); }
278 }
279
280 public static readonly PropertyInfo<char[]> CharArrayTestProperty = RegisterProperty<char[]>(c => c.CharArrayTest);
284 public char[] CharArrayTest
285 {
286 get { return GetProperty(CharArrayTestProperty); }
287 set { SetProperty(CharArrayTestProperty, value); }
288 }
289
290 public static readonly PropertyInfo<Guid> GuidTestProperty = RegisterProperty<Guid>(c => c.GuidTest);
294 public Guid GuidTest
295 {
296 get { return GetProperty(GuidTestProperty); }
297 set { SetProperty(GuidTestProperty, value); }
298 }
299
300
301 public static readonly PropertyInfo<int?> NullableIntProperty = RegisterProperty<int?>(c => c.NullableInt);
305 public int? NullableInt
306 {
307 get { return GetProperty(NullableIntProperty); }
308 set { SetProperty(NullableIntProperty, value); }
309 }
310
311 public static readonly PropertyInfo<int?> NullableButSetIntProperty = RegisterProperty<int?>(c => c.NullableButSetInt);
316 {
317 get { return GetProperty(NullableButSetIntProperty); }
318 set { SetProperty(NullableButSetIntProperty, value); }
319 }
320
321 public static readonly PropertyInfo<Csla.SmartDate> EmptySmartDateTestProperty = RegisterProperty<Csla.SmartDate>(c => c.EmptySmartDateTest);
326 {
327 get { return GetProperty(EmptySmartDateTestProperty); }
328 set { SetProperty(EmptySmartDateTestProperty, value); }
329 }
330
331 public static readonly PropertyInfo<Csla.SmartDate> FilledSmartDateTestProperty = RegisterProperty<Csla.SmartDate>(c => c.FilledSmartDateTest);
336 {
337 get { return GetProperty(FilledSmartDateTestProperty); }
338 set { SetProperty(FilledSmartDateTestProperty, value); }
339 }
340
341 internal static BinaryReaderWriterTestClass NewBinaryReaderWriterTestClass(IDataPortal<BinaryReaderWriterTestClass> dataPortal)
342 {
343 return NewBinaryReaderWriterTestClass(dataPortal, false);
344 }
345
346 internal static BinaryReaderWriterTestClass NewBinaryReaderWriterTestClass(IDataPortal<BinaryReaderWriterTestClass> dataPortal, bool isChild)
347 {
348 return dataPortal.Create(isChild);
349 }
350
351 [Create]
352 private void Create(bool isChild)
353 {
354 if (isChild)
355 MarkAsChild();
356 }
357 }
358}
Csla.Test.DataPortalTest.Single Single
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.
Maintains metadata about a property.
static readonly PropertyInfo< decimal > DecimalTestProperty
int? NullableButSetInt
Gets or sets the NullableButSetInt value.
static readonly PropertyInfo< RandomEnum > EnumTestProperty
Csla.SmartDate FilledSmartDateTest
Gets or sets the EmptySmartDateTest value.
static readonly PropertyInfo< Csla.SmartDate > EmptySmartDateTestProperty
byte[] ByteArrayTest
Gets or sets the ByteArrayTest value.
decimal DecimalTest
Gets or sets the DecimalTest value.
RandomEnum EnumTest
Gets or sets the EnumTest value.
static readonly PropertyInfo< DateTimeOffset > DateTimeOffsetTestProperty
static readonly PropertyInfo< DateTime > DateTimeTestProperty
TimeSpan TimeSpanTest
Gets or sets the TimeSpanTest value.
static readonly PropertyInfo< Csla.SmartDate > FilledSmartDateTestProperty
char[] CharArrayTest
Gets or sets the CharArrayTest value.
Csla.SmartDate EmptySmartDateTest
Gets or sets the EmptySmartDateTest value.
static readonly PropertyInfo< TimeSpan > TimeSpanTestProperty
DateTimeOffset DateTimeOffsetTest
Gets or sets the DateTimeOffsetTest value.
DateTime DateTimeTest
Gets or sets the DateTimeTest value.
static BinaryReaderWriterTestClassList NewBinaryReaderWriterTestClassList(IDataPortal< BinaryReaderWriterTestClassList > dataPortal)
Interface defining the members of the data portal type.
Definition: IDataPortalT.cs:17
object Create(params object[] criteria)
Called by a factory method in a business class to create a new object, which is loaded with default v...
@ Serializable
Prevents updating or inserting until the transaction is complete.
Provides a date data type that understands the concept of an empty date value.
Definition: SmartDate.cs:32