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?
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?
Database layer usually takes care of:
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
.
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
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.