Sachin
Sachin

Reputation: 479

Asp.net MVC with mysql

I am using ASP MVC to develop a new project. I am using the repository pattern for Data Access. I have worked on the same scenario before using SQL Server, but now I'm using MySQL.

How do I interact with MySQL using the repository pattern?

Upvotes: 0

Views: 1803

Answers (4)

reustmd
reustmd

Reputation: 3603

You could use an open source ORM like nHibernate and develop your repository layer. This supports MySQL. Then if you decide to switch back to SQL Server you'll only have to change 1 config line.

Upvotes: 1

user151323
user151323

Reputation:

Database layer usually takes care of:

  • Establishing a connection to a database
  • Converting application-level data types to database datatypes
  • Wrapping/isolating upper application level from executing directly a query

Regarding database-specific components, usually these are SqlConnection, SqlDataReader, SqlCommand etc. They are Microsoft SQL Server specific. You will need to install MySql connector and use the supplied interface.

Look here: Using MySQL Native .NET Providers

You will work with these objects: MySqlConnection, MySqlCommand, MySqlDataReader, MySqlDataAdapter, MySqlParameter, MySqlTransaction.

Upvotes: 1

davethecoder
davethecoder

Reputation: 3932

use subsonic seems to be the fastest route to MySQL with MVC, or the newer versions of the mysql data provider allow for entity framework to be used also.... but again fastest route has to be subsonic your up and running in mins

Upvotes: 0

Kris Krause
Kris Krause

Reputation: 7326

You will need to setup/install a MySql data provider.

Upvotes: 0

Related Questions