5

How to use LINQ to SQL with MySQL.

I am having one project with C# (version 2010) and LINQ to SQL. Database is SQL.

I need to migrate the project to LINQ to MySQL and C# version 2010.

And also need to migrate existing SQL database to MySQL database.

I downloaded DBLinq but don't know how to use it in project.

Dale K
  • 25,246
  • 15
  • 42
  • 71
kala
  • 111
  • 2
  • 3
  • 7

3 Answers3

8

LINQ to SQL is designed to work with Microsoft SQL Server only, as far as I know. If possible, you should migrate to Entity Framework or another DB-agnostic O/R-mapper.

Matthias Meid
  • 12,455
  • 7
  • 45
  • 79
2

Check out 'LINQ to MySql' nuget.

https://www.nuget.org/packages/linq2db.MySql/

LINQ to MySql is a data access technology that provides a run-time infrastructure for managing relational data as objects.

This package includes a T4 template to generate data models for MySql database and references to the linq2db and MySql.Data nugets.

Action Dan
  • 443
  • 4
  • 10
1

I'm pretty sure there is a provider for it (same as for SqlLite).

Take a look at the following links:

DBLinq should have everything you need though...

Littm
  • 4,923
  • 4
  • 30
  • 38
Tim Sommer
  • 419
  • 2
  • 15