I have a web service in which I declare a user defined object. One of the
properties, I declare it and default it's value as follows:
private DateTime _callbackTime = ADPDS.Utility.Utility.DBNullToDate(null);
public DateTime CallbackTime
{
set{
if(ADPDS.Utility.Utility.IsNullDate(value) == true)
_callbackTime = ADPDS.Utility.Utility.DBNullToDate(null);
else
_callbackTime = ADPDS.Utility.Utility.DBNullToDate(value);
}
get{return(ADPDS.Utility.Utility.DBNullToDate(_cal lbackTime));}
}
DBNullToDate is a simeple static method that accepts an object and returns
1/1/1900 if the object is null.
In my NUnit test method, I create the object :
WSNUnit.localhost.DataObject obj = new WSNUnit.localhost.DataObject();
I can see all the properties fine, but when I look at the default property,
I don't see it set to the default. This also happens for other property types
such as strings. I set the default to "A", but I get a null in the value
after I create the object.
Using this works fine in regular assemblies, where I declare the object in a
referenced assembly, and when I create the object in the project, it inherits
the default values as it should.
Is this behaviour different for Web Services?