@manhng

Welcome to my blog!

EF6 CodeFirst Migration

April 6, 2021 00:01

EF6 CodeFirst Migration (edit)

Client-Side Validation using a Server Framework (HTML, CSS, JavaScript)

Add Contact (apphb.com) (Deploy)

GitHub - timgthomas/validation-sample: An example of "client-side" validation using a server framework (Source)

ASP.NET MVC 5: Contoso University

GitHub - jbogard/ContosoUniversity: Contoso University sample re-done the way I would build it

GitHub - kiwsan/aspnet-mvc-contoso-university

Command Query Responsibility Segregation and Event Sourcing using ASP.NET MVC 5, MediatrR, AutoMapper, Autofac, FluentValidation, Swagger UI, Entity Framework 6.

  • CQRS & ES
  • ASP.NET MVC 5
  • Entity Framework 6
  • MediatrR
  • AutoMapper
  • Autofac
  • FluentValidation
  • Swagger UI

Building MVC Jimmy Style (thefreezeteam.azurewebsites.net) (.NET Framework)

ASP.NET Core MVC: Contoso University

GitHub - jbogard/ContosoUniversityDotNetCore (.NET Core)

Entity Framework 6 Articles:

Entity Framework - Code First Migration - Tutorialspoint

Fluent API in Entity Framework 6 (entityframeworktutorial.net)

Entity Framework Code First toàn tập | Comdy

+ Entity Framework 6

+ MS SQL Server

+ Code First

+ Connection String

+ Migrations

+ Fluent API (xem thêm ở đây)

+ Primary Key (here)

+ Database Initialization Strategy (Xem thêm các tùy chọn ở đây)

+ Fluent API: ID tự tăng (xem thêm ở đây)

+ Fluent API: Configure one-to-one relationship (here) between Student & StudentAddress

// Configure a one-to-one relationship between Student & StudentAddress
this.HasOptional(s => s.Address) // Mark Student.Address property optional (nullable)
    .WithRequired(ad => ad.Student); // Mark StudentAddress.Student property as required (NotNull).

Migrations

Enable-Migrations

Add-Migration "Initial DB Schema"

Update-Database -Verbose

Categories

Recent posts