Question

I have been goggling and reading but no luck so far;

I'm working on MVC 4 with EF 5 and I have database up and running and I'm writing a code to integrate SimpleMembership provider to my existing application/database.

I have seen lot of samples but i haven't' see how would i go integrating with Database First approach

my connection-string looks like this:

<add name="DbContextEntities" connectionString="metadata=res://*/Models1.csdl|res://*/Models1.ssdl|res://*/Models1.msl;provider=System.Data.EntityClient;provider connection string=&quot;Data Source=<hosted_site_name>; Initial Catalog=<mydb; User ID=<username>; Password=<password>&quot;" providerName="System.Data.EntityClient" />

The error I am now getting when navigating to a page that uses the DB, is:

Unable to find the requested .Net Framework Data Provider.  It may not be installed.
Was it helpful?

Solution

I had a similar problem before (trying to add SimpleMembership with a DB first approach) and I remember that I had to remove that "metadata" info from the connection string. I ended up two connection strings, one for the data model and the other for the SimpleMembership. In your case, the DbContextEntities:

<add name="DbContextEntities" connectionString="metadata=res://*/Models1.csdl|res://*/Models1.ssdl|res://*/Models1.msl;provider=System.Data.EntityClient;provider connection string=&quot;Data Source=<hosted_site_name>; Initial Catalog=<mydb; User ID=<username>; Password=<password>&quot;" providerName="System.Data.EntityClient" />

and the other one for SimpleMembership:

<add name="DbAuth" connectionString="Data Source=<hosted_site_name>; Initial Catalog=<mydb; User ID=<username>; Password=<password>&quot;" providerName="System.Data.EntityClient">

I'm sure there might be better ways of fixing it, but this one worked for me.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top