Good day, dear forum users. I am doing a learning project and faced the following question. The project consists of two parts Domain and UI. In Domaine created interfaces, their implementation and classes:
public interface IDbRepository { IQueryable<Article> Article { get; } } public class EFRepository:IDbRepository { private readonly ApplicationDbContext _context= new ApplicationDbContext(); public IQueryable<Article> Article { get { return _context.Articles; } } } //данные классы перенес из UI namespace Domain.FF { public class ApplicationUser : IdentityUser { } public class ApplicationDbContext : IdentityDbContext<ApplicationUser> { public ApplicationDbContext() : base("DefaultConnection") { } public DbSet<Article> Articles { get; set; } } } The UI announced the ninject
private void AddBindings() { // конфигурирование контейнера ninjectKernel.Bind<IDbRepository>().To<EFRepository>(); } And with such a controller implementation, I see the Article class
private IDbRepository _repository; public ХХController(IDbRepository reposit) { this._repository = reposit; } It seems like all the rules work, but the question arises how to observe the principle of loose coupling in
AccountController public class AccountController : Controller { public AccountController() : this(new UserManager<ApplicationUser>(new UserStore<ApplicationUser>(new ApplicationDbContext()))) { } Where and how to add? but it still turns out if we declare Domain.FF in the using namespace.
Thank you in advance.