- Entity Framework Tutorial
- Entity Framework - Home
- Entity Framework - Overview
- Entity Framework - Architecture
- Entity F - Environment Setup
- Entity Framework - Database Setup
- Entity Framework - Data Model
- Entity Framework - DbContext
- Entity Framework - Types
- Entity Framework - Relationships
- Entity Framework - Lifecycle
- Entity F - Code First Approach
- Entity F - Model First Approach
- Entity F - Database First Approach
- Entity Framework - DEV Approaches
- Entity F - Database Operations
- Entity Framework - Concurrency
- Entity Framework - Transaction
- Entity Framework - Views
- Entity Framework - Index
- Entity F - Stored Procedures
- Entity F - Disconnected Entities
- Entity F - Table-Valued Function
- Entity Framework - Native SQL
- Entity Framework - Enum Support
- Entity F - Asynchronous Query
- Entity Framework - Persistence
- Entity F - Projection Queries
- Entity F - Command Logging
- Entity F - Command Interception
- Entity Framework - Spatial Data Type
- Entity Framework - Inheritance
- Entity Framework - Migration
- Entity Framework - Eager Loading
- Entity Framework - Lazy Loading
- Entity Framework - Explicit Loading
- Entity Framework - Validation
- Entity Framework - Track Changes
- Entity Framework - Colored Entities
- Entity F - Code First Approach
- Entity Framework - First Example
- Entity Framework - Data Annotations
- Entity Framework - Fluent API
- Entity Framework - Seed Database
- Entity F - Code First Migration
- Entity F - Multiple DbContext
- Entity F - Nested Entity Types
- Entity Framework Resources
- Entity Framework - Quick Guide
- Entity Framework - Useful Resources
- Entity Framework - Discussion
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Entity Framework - DEV Approaches
In this chapter, let us focus on building models with the Designer or Database First or just using Code First. Following are some guidelines which will help you decide which modeling workflow to choose.
We have already seen examples of Code First modeling, Database First modeling and a Model First modeling workflow.
The Database First and Model First workflows used the Designer but one starts with the database to create a model and the other starts at the model to create a database.
For those developers who do not want to use Visual Designer plus code generation, Entity Framework has a completely different workflow called Code First.
The typical workflow for Code First is great for brand new applications where you don't even have a database. You define your classes and code and then let Code First figure out what your database should look like.
It is also possible to start Code First with a database and that makes Code First a bit of a contradiction. But there's a tool to let you reverse engineer a database into classes which is a great way to get a head start on the coding.
Given these options, let's look at the Decision Tree.
If you prefer to work with a Visual Designer in generated code, then you'll want to choose one of the workflows that involves EF Designer. If your database already exists, then Database First is your path.
If you want to use a Visual Designer on a brand new project without a database, then you'll want to use Model First.
If you just want to work with code and not a Designer, then Code First is probably for you along with the option of using the tool that reverse engineers the database into classes.
If you have existing classes, then your best bet is to use them with Code First.