WCF and NHibernate: DateTime Null Problem
While sending Nullable DateTime data type you might get an exception: "Cannot convert int32 to datetime" or something like this. This is because WCF doesnt go well with nullable datetime.
Add new methods in the class that uses nullable datatype. Add [OnSerializing] and OnDeserializing] Attributes and their respective methods in your class. In OnSerializing method assigh min datetime to your nullable field. And OnDeserializing method, assign the null value to the datetime field that has min date.
public DateTime myNullableDate? = null;
internal void OnSerializingMethod(StreamingContext context)
myNullableDate = mindate;//change the mindate with right method call
internal void OnDeserializingMethod(StreamingContext context)
myNullableDate = null;