Entity Framework: Code First

targets a database that doesn’t exist and Code First will create it

Annotations

System.ComponentModel.DataAnnotations

  • Key
    • Composite keys: Add Column Annotation [Key, Column(Order = 1)]
  • Timestamp: Only 1 allowed per Entity, and has to be a byte[]
  • ConcurrencyCheck
    • A way to add Optimistic Concurrency
    • can be applied to multiple properties
    • Will include the property in update command to check for optimistic concurrency
  • Required: NotNull
  • MinLength
  • MaxLength
  • StringLength

System.ComponentModel.DataAnnotations.Schema

  • Table
  • Column
  • Index
  • ForeignKey
  • NotMapped
  • InverseProperty

No Comments

Add a Comment

As it will appear on the website

Not displayed

Your website