We want to make use of model first to create clean EF models for the application but rather than getting the model produce a new db schema we want to then by hand perform a table mapping inside the entity for an existing database table or tables. It is possible to mechanism with this?
This really is known as Entity Framework Code-First which is a good tutorial to help getting you started.
The concept is you create some POCO classes seperate for your Repository/Database class. Within this Repository/Database class, you define all of the associations involving the POCO's. Fortunately, Entity Framework has numerous conventions which you'll leverage off, and that means you may not have to define every relationship and rule.
Eg. In case your class is known as
User, it will assume (automatically, unless of course you override this) the database table is known as
Users and also the primary key identity area within the POCO is going to be
UserId and also the same within the database table.
Unsure basically comprehend the question, however when you make use of the wizard to produce a new Entity data model, the initial step enables you to definitely "Generate from database", just point it for your existing DB. After that you can eliminate the tables you wouldn't want and/or customize the table mappings by hand. Additionally, there are the choice to select which tables you would like symbolized inside your model to begin with.