Facing problem accessing MySql Timestamp column in Entity Framework
I am using MySql .net connector 6.3.6 and Visual Studio 2008 sp1. One of the table in the database has a timestamp column. When I generate Entity mappings (.edmx file), the timestamp column is getting mapped to DateTimeOffset data type. And when I hit a Linq query on this table, I always get Null value for this column (this column is nullable) even though there are valid n开发者_开发百科on-null values in the table for this column. If I try to update the mapping to a datetime datatype, visual studio throws error.
I tried to google for possible solutions, and many places it was mentioned that MySql timestamp column should map to .net datetime datatype by default. I am not sure what the problem is?
Thanks.
I recommend you to try dotConnect for MySQL. It generates DateTime properties for the corresponding Timestamp columns.
You can download a Trial version here, the only limitation of this version is 30-day trial period.
Update. You can try editing the .edmx file using an XML editor. Set the type of the CSDL property to DateTime, and if this causes any validation issues you can try setting the type of the SSDL property to "datetime" as well.
精彩评论