views:

73

answers:

2

You can refer to this post of mine.

It is not the case that, someone will be able to generate perfect Entities from the database tables every time.

If any entity is not looking perfect, how can I tweak it? And how should I tweak it?

Or should I search for the flaw of relations in the Database, fix it first and then try to generate Entities over and over again until the desired entity is generated?

But it may happen that, I would become unable to figure out the reason of an imperfect entity being generated only looking at the database tables.

+2  A: 

You should clarify your requirements: should be everything created automatically from database or you allow hand-made updates or will do it manually (once automatically then only manual updates).

Remember, that from time to time after db structure changes you will have to generate entities again, then you may lost your changes. Consider using partial classes, so some of your code changes could be persistent across automatic generations.

But in your case let's try to figure out how how the MS has prepared the demo database and try to follow the rules. Maybe you would like to read some database design guides?

More details about your environment could help with more precise answer.

twk
VS008, Sql Server 2005, what else?
JMSA
+1  A: 

We generate the EF model based on the database. When the database changes we refresh the model. This works fine for us.

It is only if you are doing something special that you need to tweek your entities.

Shiraz Bhaiji