EntityFramework Database first or Code first

2.4k Views Asked by At

we have a existing MS SQL Database where the foreign Keys are not mapped properly. Furthermore some Views without PKs.

My Question now is should I generate the POCOs on my self with e.g. Reverse Engineer Code first or should I use the EDMX-Designer?

I tried both. With the Reverse Engineer Code first I got all the POCOs which I need but additionally crap Views and Tables which I don't want to map. The Database-first concept provided me the ability to select my Tables and Views. But at the end I got a mapping where Views had several Keys which are not design in the database. It seems like this concept just works with a proper designed DB.

So what is your advise?

Thanks a lot!

Regards, Oliver

1

There are 1 best solutions below

0
On

I agree w/ Joe, it is ultimately going to be a preference + tech decision. This may help you out from an EF expert...

Demystifying Entity Framework Strategies: Model Creation Workflow

Also, if reverse engineering the database adds unwanted tables/views is it not possible to just delete the generated classes?