Dependency Inject Interface for Persistence?

Posts   
 
    
ianvink
User
Posts: 393
Joined: 15-Dec-2006
# Posted on: 03-Jan-2013 19:51:07   

On our WCF project, classes take a "repository" inteface injected by a dependency injector.

    public class MyNiceService
    {
        public MyNiceService(IRepository myDBorFakeOne)
        {
            _DB =  myDBorFakeOne;
        }

This allows us to send in a fake repository to test our code without database connnections.

When I generate an Entity framework project, the data context is a concrete class:

public partial class IMyDataContext : DbContext

Is there a way to have LLBL create and add an Interface based on the public calls to the IMyDataContext?

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 04-Jan-2013 06:44:21   

Not explicitly. I mean, you can't tell the Designer to add interfaces to the context class. IMHO that would require a change in the templates. You could evaluate creating you own version of the template. For more info see the SDK documentation

David Elizondo | LLBLGen Support Team