Search for existing suggestions

Generate interface for custom DbContext as part of DbContext generation

7 votes
Sign in
(thinking…)
Password icon
Signed in as (Sign out)

We’ll send you updates on this idea

Luke Winikates shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

1 comment

Sign in
(thinking…)
Password icon
Signed in as (Sign out)
Submitting...
  • Luke Winikates commented  ·   ·  Flag as inappropriate

    I like using interfaces in my code to facilitate unit testing, but I have to do a lot of this myself currently: I create my edmx file and generate my classes using the .tt tempates, then use refactoring tools to extract an interface for my ObjectContext/DBContext, and put that in a partial class so that it won't be overwritten.

    It would be cool if the .tt templates distributed with entity framework could create this interface automatically-- eliminating the partial class entirely.

Feedback and Knowledge Base