Mercurial > repos > IBBoard.WarFoundry.API
diff api/Objects/WarFoundryObject.cs @ 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 | 2f3cafb69799 |
children | f58051572ec7 |
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