I'm trying to get along with building web systems with ASP.NET vNext using MVC 6 and EF7. I'm looking at this tutorial: http://stephenwalther.com/archive/2015/01/17/asp-net-5-and-angularjs-part-4-using-entity-framework-7

On the page you'll see how to add a dbContext to a project and it's registered in the startup file like this:

        // Register Entity Framework
        services.AddEntityFramework(Configuration)
            .AddSqlServer()
            .AddDbContext<MoviesAppContext>();

And the context class looks like this:

public class MoviesAppContext:DbContext
{

    public DbSet<Movie> Movies { get; set; }

}

It all works good, but now I'm in need of adding an additional DbContext. Though I don't know how to register this additional context so that it will be used by EF and possible to use in my project.

Let's say I've created a new context like this:

public class MyNewSuper:DbContext
{

    public DbSet<Model1> Model1 { get; set; }
    public DbSet<Model2> Model2 { get; set; }

}

How do I go ahead to register it for use in my project then?

Related posts

Recent Viewed