Hello there,
I have a [DataContract] called ReportRequest with a NOT NULL column 'SubmittedAt'. So my DataContract looks something like:
[DataContract]
public class ReportRequest
{
Int32 templateId;
DateTime submittedAt = DateTime.Now;
[DataMember]
public virtual Int32? Id
{
get;
set;
}
public virtual DateTime SubmittedAt
{
get {
return submittedAt;
}
set
{
submittedAt = value;
}
}
}
Because, I have taken a private variable submittedAt and is initialised with DateTime.Now,
shouldn't the SubmittedAt property have the same value??
But when i am calling NHibernate
session.Save(objReportRequest);
I am getting the error:
SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM.
Any thoughts why I am getting this error?
As a workaround for now I have changed getter for SubmittedAt property as:
get {
if (submittedAt == DateTime.MinValue)
return DateTime.Now;
else
return submittedAt;
}