Home:ALL Converter>Timestamp data from DB2 is not accurate when using EntityFramework

Timestamp data from DB2 is not accurate when using EntityFramework

Ask Time:2016-05-18T19:39:20         Author:nemo_87

Json Formatter

I have data in IBM DB2 and what I am trying to do is to get that data using EntityFramework. I have one column that has TIMESTAMP values in this format: dd.MM.yyyy hh:mm:ss.ffffff and it is primary key in that table.

When I am getting data from DB2 database time part of timestamp is lost. On the other side I have entity that has string property for that Id:

public string Id { get; set; }

This is a method that will return specific merchant. It is expected only one, because timestamps aka Ids are unique. But, when data gets pulled and when time part is lost I get 9 merchants with same Id and of course exception).

MerchantEntity IMerchantRepository.GetMerchantByRegistrationNumber(string companyRegistrationNumber)
{
     var db = merchantDataContextProvider.GetMerchantContext();
     var merchant = db.Merchants.Include(x => x.MerchantProperty).
         SingleOrDefault(x => x.MerchantProperty.CompanyRegistrationNumber == companyRegistrationNumber);
     return merchant;
}

I have tried to use DateTime type for Id, the only difference was that it was cutting last 3 numbers, instead whole time part.

Did anyone had same or similar problem? Who to get accurate data when using DB2?

Author:nemo_87,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/37298510/timestamp-data-from-db2-is-not-accurate-when-using-entityframework
yy