/// <summary> /// Assigns a key to the city, if it is filled. /// </summary> private void GenerateCityId() { string baseKey; if (CityName.HasValue()) { baseKey = CountryId.ToString(); if (StateId.HasValue) { baseKey += StateId.Value.ToString(); } baseKey += CityName; CityId = baseKey.ToMD5HashString(); } }