ASP.NET 5 / MVC 6 with MySQL database

I have plans to build an MVC 6 website that will be hosted on Linux, and I'm in the initial testing phase to see how the new ASP.NET 5 (vNext) and MVC 6 work, and can I deploy everything on Linux.

My site must use a database, and since it will be deployed on Linux, I cannot use SQL Server. I would really like to use MySQL, but maybe there are other alternatives? Let's say at the moment I need MySQL if this is not possible.

I understand that all of this is still in beta testing and not ready for production, but I just want to do the initial setup to make sure everything works before I start working on the actual website. I can not do this if there is no database connection ...

Soon, I found out that there is not yet a MySQL connector for Entity Framework 7 that uses MVC 6. Does this mean that Iโ€™m out of luck and have to wait until a new MySQL connector with support for EF7 appears? Or can I go back to EF6 on the MVC 6 website that supports MySQL? I tried to add unlocks to EF6, but there are so many dependencies in the MVC 6 template by default that all EF7 links are completely lost and have no idea how to approach this, if at all possible.

So, we summarize:

  • Can I use EF 7 with MySQL already, or do I need to wait until the new MySQL connector supports this?
  • Can I go back to EF6 and still use MVC 6 and deploy to Linux (using Mono)? If so, how do I configure this?
  • If all else fails - can I use another database with MVC 6 on Linux / Mono?
+7
mysql mysql-connector asp.net-core entity-framework-core
source share
4 answers

I know 2 solutions for you. SQLite and Postgres. Unfortunately, none of them are suitable for the production application today . Both projects are in active development. SQL Server is still the best-supported DB in EF 7. This should work from Mono, but unfortunately you will need to use Windows Server (or SQL Azure).

Sqlite

enter image description here

Not perfect for servers, but still working: EntityFramework.Sqlite is in development for EF 7. You can get beta1 from Nuget.org. This should work on Mono.

PostgreSQL

Npgsql.EntityFrame

Definitely pre-released, but builds: Postgres ( npgsql ) are also being developed on the EF7 provider. Their code is onGitHub , and you can get the pre-release package from your MyGet channel (Add https://www.myget.org/F/npgsql-unstable to your Nuget sources.)

+1
source share

Is it possible to use EF 7 with MySQL already, or do I need to wait until the new MySQL connector supports this?

There is no current module for EF7 that supports MySQL, which said I'm sure it would be interesting for the team, having a pull request created for the community effort to create a module for EF. It is still early, so who knows what will happen.

Is it possible to go back to EF6 and use MVC 6 and deploy to Linux (using Mono)? If so, how to do it?

You must be able to, you cannot use CoreCLR, but I understand that you can still withstand this on Mono. Now I noticed something (I think either Jabbr or the blog, not sure) that when CoreCLR supports linux and Mac 100%, that will be the only way to run an ASP.NET application, but again I'm not sure about that.

If all else fails - can I use another database with MVC 6 on Linux / Mono?

There is nothing that supports CoreCLR, with the exception of EF7 at this point in time, but I'm sure that as you move forward you will see that the C # libraries have been recompiled to coreclr for MySQL, Mongo, Raven, etc.

0
source share

I am trying to update this question on 12/30/2015, as it has already been developed in the ASP.NET 5 space since the question was published. At that time or this post we are in the final version of Update 1 (1.0.0-rc1-final-update1).

This is the sqlite option: http://damienbod.com/2015/08/30/asp-net-5-with-sqlite-and-entity-framework-7/ using EF7 and SQLite. Not sure if Linux is ready ...

"EntityFramework.Commands": "7.0.0-rc1-final", "EntityFramework.SQLite": "7.0.0-rc1-final"

Another option is to use EF6 with both ASP.NET 5 and MVC 6, read this post: http://dan.cx/2015/08/entity-framework-6-mysql-aspnet . This is Linux ready.

I encourage people to keep updating this issue as the community and Microsoft are still developing Linux-based solutions for ASP.NET 5 MVC 6 applications.

0
source share

The SQLite parameter is Linux and OS X. (dnxcore support)

http://damienbod.com/2016/01/07/experiments-with-entity-framework-7-and-asp-net-5-mvc-6/

http://damienbod.com/2015/08/30/asp-net-5-with-sqlite-and-entity-framework-7/

EF6 solutions do not run only on .NET.

EF7 and ASP.NET 5 should be ready for production in Q1 / Q2 2016, not specific, date not set.

PostgreSQL looks like a good solution to your problem.

0
source share

All Articles