C# Entity Framework with ASP.NET MVC Entity Framework and ASP.NET MVC Configuring Entity Framework

Amit Ghosh
Amit Ghosh
8,943 Points

Need help in setting up the Database Initializer attribute

Hi All, I am getting the below :

Failed to set the database Initializer of type 'ComicBookShared.Data.DatabaseInitializer, ComicBookShared' for DbContext type 'ComicBookShared.Data.Shared.Context, ComicBookShared' specified in the application configuration.

Below is my web config for MVC and app config for Console App:

  <context type="ComicBookShared.Data.Context,ComicBookShared">
    <databaseInitializer type="ComicBookShared.Data.DatabaseInitializer,ComicBookShared"/>

I have set up the project twice and it's still the same. Online resources say to make sure that the name of the shared library should match, which is matching in my case.

Any pointers, please ?

Are you sure that your project is name ComicBookShared and DatabaseInitializer.cs and Context.cs finds in Data Folder in thisproject ?

If you still confused, you can use git to pull repository and use -git checkout [version] to update to suitable moment in the course