- dataobjectbase_2.1.0.zip
- doc
- lib
- CatenaLogic.BlogArticles.dll
- output
- Release
- CatenaLogic.BlogArticles.dll
- CatenaLogic.Examples.exe
- Data
- Example 01 - Simple object
- Example 02 - Error validation
- Example 03 - Serialization
- Example 04 - Nested objects
- Example 05 - Backward compatibility
- Example 06 - Revert and apply
- screenshots
- Example 02 - Error validation.png
- snippets
- dataobject.snippet
- propdata.snippet
- src
- CatenaLogic.Examples
- App.xaml
- App.xaml.cs
- CatenaLogic.Examples.csproj
- Data
- Example 01 - Simple object
- Example 02 - Error validation
- Example 03 - Serialization
- Example 04 - Nested objects
- Example 05 - Backward compatibility
- Example 06 - Revert and apply
- Properties
- UI
- Input
- Windows
- Example 02 - Error validation
- Example 03 - Serialization
- Example 05 - Backward compatibility
- Example 06 - Revert and apply
- CatenaLogic.Test
- CatenaLogic
- DataObjectBase.sln
- DataObjectBase.vsmdi
- LocalTestRun.testrunconfig
- dataobjectbase.zip
|
using System;
using System.Collections.ObjectModel;
using System.Runtime.Serialization;
using CatenaLogic.Data;
namespace CatenaLogic.Examples.Data
{
/// <summary>
/// Parent Data object class which fully supports serialization, property changed notifications,
/// backwards compatibility and error checking.
/// </summary>
[Serializable]
public class Parent : DataObjectBase<Parent>
{
#region Variables
#endregion
#region Constructor & destructor
/// <summary>
/// Initializes a new object from scratch.
/// </summary>
public Parent()
: base() { }
/// <summary>
/// Initializes a new object based on <see cref="SerializationInfo"/>.
/// </summary>
/// <param name="info"><see cref="SerializationInfo"/> that contains the information.</param>
/// <param name="context"><see cref="StreamingContext"/>.</param>
public Parent(SerializationInfo info, StreamingContext context)
: base(info, context) { }
#endregion
#region Properties
/// <summary>
/// Gets or sets the name of the parent.
/// </summary>
public string Name
{
get { return GetValue<string>(NameProperty); }
set { SetValue(NameProperty, value); }
}
/// <summary>
/// Register the property so it is known in the class.
/// </summary>
public readonly PropertyData NameProperty = RegisterProperty("Name", typeof(string), "Parent");
/// <summary>
/// Gets or sets a collection of child objects.
/// </summary>
public ObservableCollection<Child> Children
{
get { return GetValue<ObservableCollection<Child>>(ChildrenProperty); }
set { SetValue(ChildrenProperty, value); }
}
/// <summary>
/// Register the property so it is known in the class.
/// </summary>
public readonly PropertyData ChildrenProperty = RegisterProperty("Children", typeof(ObservableCollection<Child>), new ObservableCollection<Child>());
#endregion
}
/// <summary>
/// Child Data object class which fully supports serialization, property changed notifications,
/// backwards compatibility and error checking.
/// </summary>
[Serializable]
public class Child : DataObjectBase<Child>
{
#region Variables
#endregion
#region Constructor & destructor
/// <summary>
/// Initializes a new object from scratch.
/// </summary>
public Child()
: base() { }
/// <summary>
/// Initializes a new object based on <see cref="SerializationInfo"/>.
/// </summary>
/// <param name="info"><see cref="SerializationInfo"/> that contains the information.</param>
/// <param name="context"><see cref="StreamingContext"/>.</param>
public Child(SerializationInfo info, StreamingContext context)
: base(info, context) { }
#endregion
#region Properties
/// <summary>
/// Gets or sets the name of the child.
/// </summary>
public string Name
{
get { return GetValue<string>(NameProperty); }
set { SetValue(NameProperty, value); }
}
/// <summary>
/// Register the property so it is known in the class.
/// </summary>
public readonly PropertyData NameProperty = RegisterProperty("Name", typeof(string), "Child");
#endregion
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.