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.
Silverlight/Serialization/ReadOnlyPerson.cs
Go to the documentation of this file.
1//-----------------------------------------------------------------------
2// <copyright file="ReadOnlyPerson.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;
10using Csla;
11
13{
15 public class ReadOnlyPerson : ReadOnlyBase<ReadOnlyPerson>
16 {
17 static ReadOnlyPerson() { }
18
19 public static ReadOnlyPerson GetReadOnlyPerson(string personName, int year)
20 {
21 ReadOnlyPerson person = new ReadOnlyPerson();
22 person.LoadProperty(NameProperty, personName);
23 person.LoadProperty(BirthdateProperty, new DateTime(year, 1, 1));
24 return person;
25 }
26
27 public static readonly PropertyInfo<string> NameProperty = RegisterProperty<string>(typeof(ReadOnlyPerson), new PropertyInfo<string>("Name"));
28
29 public static readonly PropertyInfo<DateTime> BirthdateProperty = RegisterProperty<DateTime>(
30 typeof(ReadOnlyPerson),
31 new PropertyInfo<DateTime>("Birthdate"));
32
33 public string Name
34 {
35 get { return GetProperty<string>(NameProperty); }
36 }
37
38 public DateTime Birthdate
39 {
40 get { return GetProperty<DateTime>(BirthdateProperty); }
41 }
42 }
43}
Maintains metadata about a property.
This is a base class from which readonly business classes can be derived.
Definition: ReadOnlyBase.cs:55
virtual void LoadProperty(IPropertyInfo propertyInfo, object newValue)
Loads a property's managed field with the supplied value calling PropertyHasChanged if the value does...
static ReadOnlyPerson GetReadOnlyPerson(string personName, int year)
@ Serializable
Prevents updating or inserting until the transaction is complete.