Bug #62265 Exception thrown when using TIMESTAMP column
Submitted: 26 Aug 2011 2:15 Modified: 13 Dec 2011 6:31
Reporter: Bill Seddon Email Updates:
Status: Not a Bug Impact on me:
Category:Connector / NET Severity:S2 (Serious)
Version:6.4.3 OS:Any
Assigned to: Bogdan Degtyariov CPU Architecture:Any
Tags: DATETIME TIMESTAMP, regression

[26 Aug 2011 2:15] Bill Seddon
Member Mapping specified is not valid. The type 'Edm.DateTimeOffset[Nullable

An error like the above occurs when using EF to access NULL TIMESTAMP columns with version 6.4.3  6.3.6 does not exhibit the problem.

How to repeat:
Create a table like:

CREATE TABLE `taxonomies` (
  `namespace` varchar(255) NOT NULL,
  `regulator_id` int(11) NOT NULL,
  `prefix` varchar(20) NOT NULL,
  `timestamp` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)

And map it in EF the access the table.

Suggested fix:
I think this is the re-appearance of an earlier bug.
[2 Sep 2011 13:30] Johan Stolk
6.3.7 did not have this problem either, how can I work around this?
[2 Sep 2011 13:33] Johan Stolk
This is the error I get from Visual Studio 2010 with connector 6.4.3:

Error	2	Error 2019: Member Mapping specified is not valid. The type 'Edm.DateTimeOffset[Nullable=False,DefaultValue=,Precision=]' of member 'timestamp' in type 'pciadminModel.company' is not compatible with 'MySql.timestamp[Nullable=False,DefaultValue=,Precision=0]' of member 'timestamp' in type 'pciadminModel.Store.companies'.	C:\src\net\PCI\PCIData\Models\PCIModel.edmx	1637	17	PCIData

no problems in version 6.3.7...
[7 Oct 2011 7:07] Valeriy Kravchuk
Please, check if the same problem still happens with a newer version, 6.4.4.
[7 Oct 2011 16:46] Bill Seddon
In part 6.4.4 addresses the problem. If I create a model using 6.4.4 everything seems to work - though perhaps that was also the case with 6.4.3 as I never tried.

However when 6.4.4 is used with the model generated using 6.3.6 the problem still exists.  That is, I cannot update the MySQL driver (or use my utility on a machine on which a later driver is already in the GAC) with a version of my utility compiled against an earlier version of the connector.
[12 Dec 2011 12:07] Bogdan Degtyariov
Hi Bill,

It is not completely clear what exactly I should do to reproduce the bug.
Should I first generate a model using Connector/NET 6.3.6, upgrade the driver to
the version 6.4.4 and then try opening the previously created model?
Please confirm.
[12 Dec 2011 12:29] Bill Seddon
Create an application using 6.4.4 based on a table created using the script at the beginning of this thread.  Then deploy it to a machine on which 6.3.6 is installed.

The client would not move to 6.4.4 and I'm not sure what you can do about the problem I had.  In the end I moved to NHibernate.
[13 Dec 2011 6:31] Bogdan Degtyariov

This bug is related to http://bugs.mysql.com/bug.php?id=55351

As you can see, versions 6.3.8 and 6.4.2 are mapping TIMESTAMP columns as 'System.DateTime' instead of 'System.DateTimeOffset'.

That is why Connector/NET 6.3.6 is confused when encountering 'System.DateTime'.

Your client has to upgrade 6.3.6 at least to 6.3.8 in order to resolve the problem.

Alternatively, you can manually edit the edmx file and replace

<Property Name="timestamp" Type="DateTime" />


<Property Name="timestamp" Type="DateTimeOffset" />

This is not a bug, bug the expected behavior caused by changes in the new versions of Connector/NET. I am afraid we cannot do anything to make 6.4.4 backward compatible with 6.3.6.
[8 Jul 2015 20:06] Eduardo Rivera
I have a problem and i think is related to this issue.

I am using Connector 6.9.6. My Mysql-databse has a table with a timestamp column that is mapped to a System.DateTime. This should be mapped to DateTimeOffset type. How can i handle this?.