changeset 124:d59aa4e46761

Re #54: Add Army support to WarFoundryFactory * Handle empty string as well as null for ID to mean "auto-generate"
author IBBoard <dev@ibboard.co.uk>
date Mon, 24 Aug 2009 19:32:55 +0000
parents 52e8c3cdde10
children c60fd5664698
files api/Objects/WarFoundryObject.cs
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/api/Objects/WarFoundryObject.cs	Mon Aug 24 19:30:19 2009 +0000
+++ b/api/Objects/WarFoundryObject.cs	Mon Aug 24 19:32:55 2009 +0000
@@ -34,7 +34,7 @@
 		{
 			get
 			{
-				if (id == null)
+				if (id == null || id == "")
 				{
 					id = GenerateID();
 				}
@@ -42,7 +42,11 @@
 				return id;
 			}
 			
-			set { id = (value == null ? GenerateID() : value.Trim()); }
+			set
+			{
+				string newId = (value == null ? "" : value.Trim());
+				id = (newId == "" ? GenerateID() : newId);
+			}
 		}
 
 		public virtual string Name