Entity Framework Code-First(2):What is Code-First?
What is Code-First?:
Entity Framework introduced Code-First approach from Entity Framework 4.1. Code-First is mainly useful in Domain Driven Design. With the Code-First approach, you can focus on the domain design and start creating classes as per your domain requirement rather than design your database first and then create the classes which match your database design. Code-First APIs will create the database on the fly based on your entity classes and configuration.

As a developer, you first start by writing C# or VB.net classes and context class. When you run the application, Code First APIs will create the new database (if it does not exist yet) and map your classes with the database using default code-first conventions. You can also configure your domain classes to override default conventions to map with database tables using DataAnnotation attributes or fluent API.
The basic workflow would be:
Write application domain classes and context class→ configure domain classes for additional mapping requirements → Hit F5 to run the application → Code First API creates new database or map existing database with domain classes → Seed default/test data into the database → Finally launches the application
Let's see simple code first example in the next chapter.
Entity Framework Code-First(2):What is Code-First?的更多相关文章
- Entity Framework Tutorial Basics(11):Code First
Code First development with Entity Framework: Entity Framework supports three different development ...
- Entity Framework Tutorial Basics(37):Lazy Loading
Lazy Loading: One of the important functions of Entity Framework is lazy loading. Lazy loading means ...
- Entity Framework Tutorial Basics(36):Eager Loading
Eager Loading: Eager loading is the process whereby a query for one type of entity also loads relate ...
- Entity Framework Tutorial Basics(32):Enum Support
Enum in Entity Framework: You can now have an Enum in Entity Framework 5.0 onwards. EF 5 should targ ...
- Entity Framework Tutorial Basics(29):Stored Procedure in Entity Framework
Stored Procedure in Entity Framework: Entity Framework has the ability to automatically build native ...
- Entity Framework Tutorial Basics(28):Concurrency
Concurrency in Entity Framework: Entity Framework supports Optimistic Concurrency by default. In the ...
- Entity Framework Tutorial Basics(27):Update Entity Graph
Update Entity Graph using DbContext: Updating an entity graph in disconnected scenario is a complex ...
- Entity Framework Tutorial Basics(22):Disconnected Entities
Disconnected Entities: Before we see how to perform CRUD operation on disconnected entity graph, let ...
- Entity Framework Tutorial Basics(19):Change Tracking
Change Tracking in Entity Framework: Here, you will learn how entity framework tracks changes on ent ...
- Entity Framework Tutorial Basics(15):Querying with EDM
Querying with EDM: We have created EDM, DbContext, and entity classes in the previous sections. Here ...
随机推荐
- python3 mysql 多表查询
python3 mysql 多表查询 一.准备表 创建二张表: company.employee company.department #建表 create table department( id ...
- 第十篇、模块一、sys\os\hashlib模块的应用
一.模块分为三种 1)自定义模块 2)第三方模块 3)内置模块 如何导入模块? 下面两种: 1)import 模块名字 as 别名(重新给模块命名) 2)from 模块名字 import 功能( ...
- 让IE6支持max_height、max_width等等
推荐使用min-height:500px;_height:500px;来解决IE6不能max和min属性的问题.
- ATI AMD
AMD是一个CPU公司,而ATI是一个显卡公司.在2006年7月24日,AMD公司将ATI公司百分之百收购了,也自然和AMD结为一体,也生产显卡了.它们的区别如下1:它们生产的物品不同,AMD生产处理 ...
- Hadoop-HA配置详细步骤
1. HA服务器配置 对hdfs做高可用 1.1服务器详情 服务器:centos7 Hadoop:2.6.5 Jdk:1.8 共四台服务器 192.168.1.111 node1 192.168.1. ...
- JavaWeb -- Session应用实例 -- 随机中文验证码 检验
注册页面 login.html <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE html ...
- Sobel边缘检测
Sobel算子:[-1 0 1 -2 0 2 -1 0 1] 用此算子与原图像做卷积,可以检测出垂直方向的边缘.算子作用在图像的第二列,结果是:200,200,200:作用在第三列,结果是 ...
- SpringBoot_05_热部署和debug
一.pom.xml配置 增加以下pom.xml配置 <!--1.spring-boot插件--> <plugin> <groupId>org.springframe ...
- leetcode 5 Longest Palindromic Substring(Manacher算法求最长回文串)
应用一下manacher算法就可以O(n)求出结果了.可以参考hdu3068 substr(start,length)函数是这样用的: substr 方法 返回一个从指定位置开始,并具有指定长度的子字 ...
- 【python2/3坑】从gensim的Word2Vec.load()的中文vector模型输出时显示unicode码
服务器上python2.7 打印出的e[0]对应的是 unicode码 于是分别尝试了用e[0].encode('utf-8')转码 和 e[0].decode('unicode-escape')依然 ...