Files
using.cash/Basic/Types/BasicGeography.cs
T
2014-12-05 22:12:51 +01:00

65 lines
1.9 KiB
C#

using System;
using Swarmops.Basic.Interfaces;
namespace Swarmops.Basic.Types
{
/// <summary>
/// A geographical node.
/// </summary>
[Serializable]
public class BasicGeography : IHasIdentity
{
public BasicGeography (int geographyId, int parentGeographyId, string name)
: this (geographyId, parentGeographyId, name, 0)
{
}
public BasicGeography (int geographyId, int parentGeographyId, string name, int generation)
{
GeographyId = geographyId;
ParentGeographyId = parentGeographyId;
Name = name;
Generation = generation;
}
public BasicGeography (BasicGeography original)
: this (original.GeographyId, original.ParentGeographyId, original.Name, original.Generation)
{
}
[Obsolete ("Do not use this ctor. It is provided to enable serializability.", true)]
public BasicGeography()
{
// provided for serializability - does not initialize fields
}
/// <summary>
/// The database id of this geography.
/// </summary>
public int GeographyId { get; private set; }
/// <summary>
/// The database id of the parent geography, for linking in a tree structure.
/// </summary>
public int ParentGeographyId { get; protected set; }
/// <summary>
/// The friendly name of the node (city, county, region, etc).
/// </summary>
public string Name { get; protected set; }
/// <summary>
/// The generation of this node. Used in tree-style listings.
/// </summary>
public int Generation { get; protected set; }
#region IHasIdentity Members
public int Identity
{
get { return GeographyId; }
}
#endregion
}
}