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

前端 未结 6 2206
你的背包
你的背包 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:39

    The only (free) linq provider for MySql is DbLinq, and I believe it is a long way from production-ready.

    There is also MyDirect.Net which is commercial, but I have heard mixed reviews of it's capability.

    I've read that MySql will be implementing the Linq to Entities API for the 5.3 version of the .net connector, but I don't know if there's even a timeline for that. In fact, MySql has been totally silent about Entity Framework support for months.


    Addendum: The latest release of the MySql Connector/Net 6.0 has support for the EF according to the release notes. I have no idea how stable/useful this is, so I'd love to hear from anybody who have tried it.

    0 讨论(0)
  • 2021-01-02 05:39

    Not sure about Mono, but I just started using LightSpeed and that supports LINQ-to-MySQL.

    0 讨论(0)
  • 2021-01-02 05:41

    According to the Mono roadmap I'm not sure if Linq is available for mono?

    At least some of Linq might be available in the very latest release, but Linq to DB is listed for Mono 2.4 (Feb 2009)

    0 讨论(0)
  • 2021-01-02 05:42

    LINQ to SQL is simply a ORM layer leveraging the power of expressions to make it easy to construct queries in your code.

    If you are just calling adhoc queries for your tool, there is little need to use LINQ, it just adds an extra layer of abstraction to your code.

    0 讨论(0)
  • 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.

    0 讨论(0)
  • 2021-01-02 05:49

    at this time you cannot use linq to sql, you might look into a third party linq mysql provider or linq to entities. linq to sql only works for sql server databases.

    0 讨论(0)
提交回复
热议问题