How to use Dependency Injection with Entity Framework DbContext?
<p>I am currently working on including a new functionality for a Website.</p>

<p>I have a DbContext class which I created using EF6.</p>

<p>The website uses a Master Layout in which sublayouts are rendered depeding upon the page requested. I want to use Dependency Injection to access the DbContext in the Sublayouts. Generally, I would use a Controller to handle the calls, however, I want to skip that in this case.</p>

<p>Also, I want to keep the implementation flexible so that new DbContexts are added I will be able to use them easily.</p>

<p>I was thinking of creating an interface "IDbContext". </p>

<p>I will have the new interface(let's say "IRatings") implementing this interface.</p>

<p>Am I going about it the right way?</p>

<p>Any thoughts?</p>