using System; using Swarmops.Basic.Interfaces; namespace Swarmops.Basic.Types { /// /// A geographical node. /// [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) { this.GeographyId = geographyId; this.ParentGeographyId = parentGeographyId; this.Name = name; this.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 } /// /// The database id of this geography. /// public int GeographyId { get; private set; } /// /// The database id of the parent geography, for linking in a tree structure. /// public int ParentGeographyId { get; protected set; } /// /// The friendly name of the node (city, county, region, etc). /// public string Name { get; protected set; } /// /// The generation of this node. Used in tree-style listings. /// public int Generation { get; protected set; } #region IHasIdentity Members public int Identity { get { return this.GeographyId; } } #endregion } }