I'm having trouble getting ExecuteStoreQuery
to work correctly with my custom class which has a DateTime
member. It gets the default DateTime
value (1/1/0001 12:00:00 AM) instead of what is in the database.
List<MyInfo> results = context.ExecuteStoreQuery<MyInfo>(SELECT [StartTime] FROM [dbo].[Records] WHERE [Type] = 1).ToList();
MyInfo class definition:
public class MyInfo
{
private DateTime startTime;
public DateTime StartTime
{
get { return startTime; }
set { startTime = value; }
}
}
However if I query using DateTime
instead of MyInfo, the correct date is returned.
List<DateTime> results = context.ExecuteStoreQuery<DateTime>(SELECT [StartTime] FROM [dbo].[Records] WHERE [Type] = 1).ToList();