How can I use Linq with a MySql database on Mono?

前端 未结 6 2209
你的背包
你的背包 2021-01-02 05:01

There are numerous libraries providing Linq capabilities to C# code interacting with a MySql database. Which one of them is the most stable and usable on Mono?

Backg

6条回答
  •  执笔经年
    2021-01-02 05:46

    I have tried the tutorial at http://www.primaryobjects.com/CMS/Article100.aspx. This uses dblinq/dbmetal to generate the data context class and classes for each table.

    The code failed at the first attempt with an unhandled exception (MySql.Data.Types.MySqlConversionException: Unable to convert MySQL date/time value to System.DateTime"). Googling revealed this should be easily solved by appending "Allow Zero Datetime=True;" to the connection string. Unfortionately this turned out not to solve my problem. Thinking the MySQL .Net Connector was to blame I executed the SQL generated by dblinq without the linq2sql intermediary layer using the MySQL Connector. This time no exception occured. Tables which do not have a date column did work with DbLinq. So, from my experiment I agree with Adam, DbLinq is a long way from production ready.

提交回复
热议问题