I have installed the MySql Connector 6.6.5 from http://dev.mysql.com/downloads/connector/net/
I have added it as a reference in my asp.net MVC website (please see screenshots below), and changed "Copy local" to true.
However, when I get to the line:var calls = db.Calls.ToList(); I get the error:
Unable to find the requested .Net Framework Data Provider. It may not be installed.
I've included my code below. Can anyone please let me know what I'm missing?
Thanks, Mark
Controller Call.cs:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using MySql.Data;
using MySql.Data.Entity;
using MySql.Data.MySqlClient;
using MySql.Web;
using System.Data;
namespace bm.Controllers
{
public class CallController : Controller
{
private CallContext db = new CallContext();
//
// GET: /Calls/
public ActionResult Index()
{
var calls = db.Calls.ToList();
return View(calls);
}
}
}
CallContext.cs
using bm.Models;
using System.Data.Entity;
public class CallContext : DbContext
{
static CallContext()
{
}
public CallContext()
: base("callsConn")
{
}
public DbSet<Call> Calls { get; set; }
}
Web.Config Connection String:
<connectionStrings>
<add name="callsConn" connectionString="Server=xxx;Port=3306;Database=xxxx;Uid=root;Pwd=;" providerName="MySql.Data.MySqlClient" />
</connectionStrings>
References:
