Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

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

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:

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

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 ?

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

1 Answer

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