Can I get the DbContext created by LinqPad?

I am trying to test my IRepository interface via linqpad. To create it, I have a constructor that looks like this:

IRepository dataAccess = new GenericRepository(dbContext);

This works fine in my own code, but I don't know how to get to dbContext in linqpad. (I would rather not create my own unless I need it.

All my code uses IRepository (so I can unit test). I cannot test it in LinqPad if I cannot create a GenericRepository using dbContext.

Any idea how I can get in the DbContext created by LinqPad?

+4
source share
1 answer

EF-. this, .

+11

All Articles