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 Basics Introducing Entity Framework Adding Our First Entity Using the Code First Workflow

Is it a good practice to modify generated code from Database first?

For example, I do not always create databases in Code first. I like to design my databases in sql server and import them in Entity framework. I noticed EF generates the code for me, but what if I want to make changes? Is it good practice to modify the generated code OR just update my data via sql server?

1 Answer

Chris Roberts-Watts
Chris Roberts-Watts
5,434 Points

Why can you not just use EF to regenerate your code again after making changes in SQL server?

I donโ€™t think there is a huge problem in updating your generated EF code but it will become time consuming and more fiddly the larger the database and code base becomes. As mentioned in the video this is why code first was created.