LINQ to Entities does not recognize the method ‘System.DateTime GetValueOrDefault()’

You should be able to use the Null Coalescing operator ??:

addresses = (from a in db.ADDRESS
             where a.CUSTOMER_NUMBER.Equals(customer_number)
             select new AddressModel
             {
                 Address_Id = a.ADDRESS_ID,
                 System_Id = a.SYSTEM_ID,
                 Customer_Number = a.CUSTOMER_NUMBER,
                 Address_Type = a.ADDRESS_TYPE,
                 Changed_On = a.CHANGED_ON ?? DateTime.MinValue,
                 Created_On = a.CREATED_ON ?? DateTime.MinValue,
                 Email = a.EMAIL
              }).ToList(); 

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)