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 trialJoe Mackey
20,418 PointsIn Context.cs add a default constructor that sets the database initializer to an instance of the DropCreateDatabaseAlway
I am missing something but seems I am not able to solve this issue a little help
using System.Data.Entity;
namespace Treehouse.CodeChallenges
{
public class Context : DbContext
{
// DEFAULT CONSTRUCTOR
Public Context()
{
//database initializer to an instance of the DropCreateDatabaseAlways class
//so that EF will drop and create our database on every app start
Database.SetInitializer(new DropCreateDatabaseAlways<Context>());
}
public DbSet<Course> Courses { get; set; }
}
}
2 Answers
Steven Parker
231,198 PointsJust one little typo...
You wrote "Public" (with a capital "P") instead of "public" (with a lower-case "p").
Asaad Khattab
38,121 PointsHello Joe! You shouldn't capitalize "public" on line 8. Other than that the task should pass as it did so for me.
using System.Data.Entity;
namespace Treehouse.CodeChallenges
{
public class Context : DbContext
{
// DEFAULT CONSTRUCTOR
public Context()
{
//database initializer to an instance of the DropCreateDatabaseAlways class
//so that EF will drop and create our database on every app start
Database.SetInitializer(new DropCreateDatabaseAlways<Context>());
}
public DbSet<Course> Courses { get; set; }
}
}