I have a LINQ to SQL Data Context containing a class with two Date properties:
DateActive DateTime NOT NULL
DateInactive DateTime NULL
The MSDN clearly states:
The LessThanOrEqual operator determines the relationship between two DateTime values by comparing their number of ticks. Before comparing DateTime objects, make sure that the objects represent times in the same time zone. You can do this by comparing the values of their Kind property.
http://msdn.microsoft.com/en-us/library/system.datetime.op_lessthanorequal.aspx
But in my LINQ queries the two above fields are showing as DateTimeKind.Unspecified
where I am comparing to Date.Today
which is DateTimeKind.Local
.
Is there a nice way of specifying the above properties as DateTimeKind.Local
throughout the entire application so I don't have to convert like i.DateActive.ToLocalTime.Date
and i.DateInactive.Value.ToLocalTime.Date
everywhere?
I am using .NET 4 not .NET 4.5 so I'm presuming the same applies.