2013年5月19日 星期日

Data Annotations & Fluent API

 

image

image

 

System.ComponentModel.DataAnnotations

image

 

Fluent Relationships

image

 

Example 1, Data Annotations

1. Primary Key

2. Relationship & ForeignKey

3. Column Name

image

 

Example 2, Fluent API, same as above example

1. Primary Key

2. Relationship & ForeignKey

3. Column Name

image

 

Example 3, Fluent API but group it, same as above example

DbModelBuilder.Configuration.Add()

EntityTypeConfiguration<EntityName>

image

 

Fluent API Configurations

image

沒有留言:

張貼留言