|
using System;
using System.Xml.Serialization;
using Codebasement.DomainDrivenDesign.Basement.Basement;
using Codebasement.DomainDrivenDesign.Basement.EventArguments;
namespace Codebasement.DomainDrivenDesign.Basement.Basement
{
/// <summary>
/// Summary description for Parameter.
/// </summary>
[Serializable]
public class Parameter
{
[NonSerialized] private BasementObject _basementObject;
[NonSerialized] private bool _isDirty;
private string _name = String.Empty;
private string _value = String.Empty;
/// <summary>
/// Initializes a new instance of the <see cref="Parameter"/> class.
/// </summary>
public Parameter()
{
}
/// <summary>
/// Initializes a new instance of the <see cref="Parameter"/> class.
/// </summary>
/// <param name="basementObject">The basement object.</param>
/// <param name="name">The name.</param>
public Parameter(BasementObject basementObject, string name) : this()
{
_basementObject = basementObject;
_name = name;
}
/// <summary>
/// Gets or sets the name
/// </summary>
public string Name
{
get { return _name; }
set { _name = value; }
}
/// <summary>
/// IsUpdated
/// </summary>
[XmlIgnore]
public bool IsDirty
{
get { return _isDirty; }
set { _isDirty = value; }
}
/// <summary>
/// Gets or sets the content.
/// </summary>
/// <value>The content.</value>
public string Value
{
get { return _value; }
set
{
string oldValue = _value;
string newValue = String.Empty;
if (value != null)
{
newValue = value;
}
// assign value if different
if (oldValue != newValue)
{
_value = newValue;
// mark property as changed
_isDirty = true;
// raise change event on BasementObject
if (_basementObject != null)
_basementObject.OnBasementObjectUpdated(new BasementObjectEventArgs(_basementObject));
}
}
}
}
}
|
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.