Last active
October 16, 2017 08:44
-
-
Save thangchung/286d18f9299ce8cbb65d3b9d509b21a3 to your computer and use it in GitHub Desktop.
Applying clean architecture on web application with modular patterns
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using BlogCore.Infrastructure.EfCore; | |
using BlogCore.PostContext.Core.Domain; | |
using Microsoft.EntityFrameworkCore; | |
using System; | |
using System.Collections.Generic; | |
namespace BlogCore.PostContext.Infrastructure | |
{ | |
public class PostDbContext : DbContext | |
{ | |
public PostDbContext(DbContextOptions<PostDbContext> options) | |
: base(options) | |
{ | |
} | |
protected override void OnModelCreating(ModelBuilder modelBuilder) | |
{ | |
var entityTypes = new List<Type> | |
{ | |
typeof(Post), | |
typeof(Comment), | |
typeof(Tag) | |
}; | |
var valueTypes = new List<Type> | |
{ | |
typeof(BlogId), | |
typeof(AuthorId) | |
}; | |
base.OnModelCreating(modelBuilder.RegisterTypes(entityTypes, valueTypes, "post", "post")); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment