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![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![marcolamoon](https://secure.gravatar.com/avatar/512fb55c1332b4cde32b1dd987140c12?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
marcolamoon
16,915 PointsHELP with framework question??
In Configuration.cs update the Seed method so that the database is only seeded with the students test data when the application is being built with the Debug build configuration. To do that, wrap the call to the context's Students DbSet property's AddOrUpdate method in an #if preprocessor directive and test for the presence of the DEBUG symbol.
I keep getting bummer and i;m not for sure whats wrong.
using System.Data.Entity.Migrations;
namespace Treehouse.CodeChallenges
{
public class Configuration : DbMigrationsConfiguration<Context>
{
public Configuration()
{
AutomaticMigrationsEnabled = false;
}
#if DEBUG
protected override void Seed(Context context)
{
context.Students.AddOrUpdate(
s => s.Id,
new Student() { Id = 1, FirstName = "John", LastName = "Smith" },
new Student() { Id = 2, FirstName = "Sally", LastName = "Jones" }
);
#endIf
}
}
}
2 Answers
![Steven Parker](https://uploads.teamtreehouse.com/production/profile-photos/969492/micro_tool_chess_set_2.jpg)
Steven Parker
230,688 PointsAlways make sure parentheses and braces match inside a conditional.
Otherwise, when the condition is not met, the code will not compile.
Also, you don't want to make the method itself conditional, just the code in the body.
![Matthew Miles](https://secure.gravatar.com/avatar/3878f08e7b3cef61990c63c22d7d76b0?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Matthew Miles
13,770 Pointsyou also capitalized the 'if' in #endIf. try #endif
marcolamoon
16,915 Pointsmarcolamoon
16,915 Pointsso i just noticed it wants me to change " protected override void Seed(Context context)" but i'm not sure what to change it to. i re watch the video and still don't get it.
Steven Parker
230,688 PointsSteven Parker
230,688 PointsI'm not sure what you mean. But if you just move that "
#if DEBUG
" to the correct line it will pass the challenge.