Adam replied on Thursday, May 14, 2009
I too have been haivng this problem and after some searching have found a bug in the csla framework in Utilities.cs in CoerceValue ln:181 where
if ((desiredType.IsPrimitive || desiredType.Equals(typeof(decimal))) &&
valueType.Equals(typeof(string)) && string.IsNullOrEmpty((string)value))
value = 0;
looks like it should be
if ((desiredType.IsPrimitive || desiredType.Equals(typeof(decimal))) &&
string.IsNullOrEmpty(value.ToString()))
value = 0;
as currently it's type checking for a string but not all primatives are strings
but to overcome this I have adapted my templates to use
LoadProperty<long, long>(myIDProperty , data.myID.GetValueOrDefault(...default value here...));from this
postHope this helps anyone in the same situation :)