Materialize nullable DateTime field does not work

Thread is closed for posting
2 posts, 0 answers
  1. Markus
    Markus avatar
    43 posts
    Member since:
    Sep 2008

    Posted 10 Feb 2017 Link to this post

    Hi,

    I have a class 'Equipment' with nullable datetime field 'PurchaseDate'. When execute sql query and materialize to non-persistent type, datetime field is always null. When I change data type to DateTime it works, but null values in database are mapped to DateTime.MinValue in object. Which causes problems when showing in RadGridView and GridViewDateTimeColumn.

    DataAccess Version: 2016.2.822.1

     

    string sqlSelect = "SELECT Name, Description, PurchaseDate FROM Equipment";
     
    using (Telerik.OpenAccess.OpenAccessContext ctx = DbContext.DbContextFactory.Instance.GetNew())
    {
        IList<ListModel.Equipment> list = ctx.ExecuteQuery<ListModel.Equipment>(sqlSelect);
        return list;
    }
  2. Markus
    Markus avatar
    43 posts
    Member since:
    Sep 2008

    Posted 10 Feb 2017 in reply to Markus Link to this post

    Please ignore my post there was an bug in my code. Misspelling and wrong Select-command
Back to Top