Click here to Skip to main content
16,011,805 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Am getting
No Entity Framework provider found for the ADO.NET provider with invariant name 'System.Data.SqlServerCe.4.0'. Make sure the provider is registered in the 'entityFramework' section of the application config file.

XML
<connectionStrings>
 <add name="ComicContextDb" connectionString="Data Source=|DataDirectory|\Database1.sdf" providerName="System.Data.SqlServerCe.4.0"/>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
<providers>
  <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
controller.cs

        private ComicContext database = new ComicContext("ComicContextDb");
    [HttpPost]
    public ActionResult RSVPForm(GuestResponse from)
    {
        database.Database1.Add(from);
        database.SaveChanges();
        return Content("New comic added.");
    }
Posted

1 solution

Hi Karthik,


Do you have entity framework installed on your machine?
By installing SQL Server compact edition would resolve this issue.
You can download it from http://www.microsoft.com/en-in/download/details.aspx?id=17876

Updated solution:

Have you defined ID for the table, by default every table should have primary key ID.Just add ID element to the class file, entity framework will consider ID as primary key by default.

Hope this helps you a bit

Regards,
RK
 
Share this answer
 
v4
Comments
karthik mushyam 11-Nov-13 5:00am    
ya i installed that
but even am getting ModelValidation exception
in above controller .cs
♥…ЯҠ…♥ 11-Nov-13 5:04am    
"No Entity Framework provider found" error vanished right? which line you get error and what error? brief it
karthik mushyam 11-Nov-13 5:09am    
database.Database1.Add(from); in above controller.cs line am getting ModalValidationexception

MvcApplication1.Models.GuestResponse: : EntityType 'GuestResponse' has no key defined. Define the key for this EntityType.

Database1: EntityType: EntitySet 'Database1' is based on type 'GuestResponse' that has no keys defined.
♥…ЯҠ…♥ 11-Nov-13 5:18am    
updated the solution upon your comment.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900