Skip to content

Instantly share code, notes, and snippets.

@thangchung
Last active October 16, 2017 08:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thangchung/286d18f9299ce8cbb65d3b9d509b21a3 to your computer and use it in GitHub Desktop.
Save thangchung/286d18f9299ce8cbb65d3b9d509b21a3 to your computer and use it in GitHub Desktop.
Applying clean architecture on web application with modular patterns
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