From 6af0345ebc736a9864de576eb81522efd9c614e3 Mon Sep 17 00:00:00 2001 From: Rick Falkvinge Date: Mon, 5 Nov 2012 12:02:10 +0000 Subject: [PATCH] Added default ctors to more classes --- Basic/Types/BasicCity.cs | 7 +++++++ Basic/Types/BasicCountry.cs | 6 ++++++ Basic/Types/BasicPostalCode.cs | 6 ++++++ 3 files changed, 19 insertions(+) diff --git a/Basic/Types/BasicCity.cs b/Basic/Types/BasicCity.cs index c89dd207..5bbb9d91 100644 --- a/Basic/Types/BasicCity.cs +++ b/Basic/Types/BasicCity.cs @@ -5,6 +5,7 @@ using Activizr.Basic.Interfaces; namespace Activizr.Basic.Types { + [Serializable] public class BasicCity : IHasIdentity { public BasicCity (int cityId, string name, int countryId, int geographyId) @@ -20,6 +21,12 @@ namespace Activizr.Basic.Types { } + [Obsolete ("Do not call this ctor directly. It exists to enable serialization.", true)] + public BasicCity() + { + // this ctor should never be called from code + } + private int cityId; private string name; private int countryId; diff --git a/Basic/Types/BasicCountry.cs b/Basic/Types/BasicCountry.cs index 606235cb..b9b23a69 100644 --- a/Basic/Types/BasicCountry.cs +++ b/Basic/Types/BasicCountry.cs @@ -33,6 +33,12 @@ namespace Activizr.Basic.Types { } + [Obsolete ("Do not call this function directly. It exists to enable serialization.", true)] + public BasicCountry() + { + // this does not initialize the Basic Country, but exists to enable serialization. + } + public int CountryId { get { return countryId; } diff --git a/Basic/Types/BasicPostalCode.cs b/Basic/Types/BasicPostalCode.cs index bfaf4e80..74f08395 100644 --- a/Basic/Types/BasicPostalCode.cs +++ b/Basic/Types/BasicPostalCode.cs @@ -19,6 +19,12 @@ namespace Activizr.Basic.Types { } + [Obsolete ("Do not call this ctor directly. It exists to enable serialization.", true)] + public BasicPostalCode() + { + // this should never be called from code + } + public string PostalCode { get; private set; } // any whitespace removed public string CityName { get; protected set; } public string CountryCode { get; protected set; }