woggles
woggles

Reputation: 7444

Entity Framework code first around existing database

I have to create some new entities in a new or existing database using Entity Framework that will need to interact with some legacy tables and I'm wondering what the best approach is here. I was hoping to use Code First with migrations.

For example, say I have an existing populated Person table and I need to create a Animal table that will contain a PersonId foreign key to reference the existing people.

As far as I can tell these are my options:

Are there any better options that I'm missing or should I go ahead with using Database first?

Upvotes: 0

Views: 2410

Answers (1)

Sampath
Sampath

Reputation: 65870

You can use EntityFramework Reverse POCO Code First Generator.

Reverse engineers an existing database and generates Entity Framework Code First Poco classes, Configuration mappings and DbContext. This generator was designed to be customisable from the very beginning, and not fixed and rigid like other generators. Go and play with the settings in the .tt file, that's what it's there for.

Here is the link : EntityFramework Reverse POCO Generator

Upvotes: 3

Related Questions