loyalflow
loyalflow

Reputation: 14879

How would separate projects share EF DbContext?

How should I break out a project, with the ability to share the EF DbContext.

This is a new project, and the idea was to have something like this:

Appname.Common

Appname.Models

Appname.Service1
Appname.Service2

Appname.Web

Now with the above VS.NET 2012 solution, I am currently planning on having repositories for each service project, but how will I share the EF context around between the 2 services?

What options do I have?

Note: both Service1 and Service2 are using the same database

Upvotes: 0

Views: 539

Answers (1)

Joe Ratzer
Joe Ratzer

Reputation: 18549

Why can't you inject the DbContext, using DI, into your repositories?

Upvotes: 2

Related Questions