Skip to content

Instantly share code, notes, and snippets.

@thangchung
Created October 16, 2017 09:56
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/3d3f82817064d2e8e4d1d2e65c50095f to your computer and use it in GitHub Desktop.
Save thangchung/3d3f82817064d2e8e4d1d2e65c50095f to your computer and use it in GitHub Desktop.
Applying clean architecture on web application with modular patterns
using Autofac;
using BlogCore.Api.Features.Posts.ListOutPostByBlog;
using BlogCore.Infrastructure.EfCore;
using BlogCore.PostContext.Infrastructure;
using BlogCore.PostContext.UseCases.ListOutPostByBlog;
namespace BlogCore.PostContext
{
public class PostUseCaseModule : Module
{
protected override void Load(ContainerBuilder builder)
{
base.Load(builder);
builder.Register(x =>
DbContextHelper.BuildDbContext<PostDbContext>(
x.ResolveKeyed<string>("MainDbConnectionString")))
.SingleInstance();
builder.RegisterType<ListOutPostByBlogInteractor>()
.AsSelf()
.SingleInstance();
builder.RegisterType<ListOutPostByBlogPresenter>()
.AsSelf()
.SingleInstance();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment