Idea : The API should have a ModuleContext class in place of dbContext

Oct 15, 2013 at 8:40 AM
Edited Oct 15, 2013 at 8:55 AM
Folllowing in the lines of Model driven architecture i would like to propose the idea of defining a modulecontext to use in place of a dbcontext.
I use modules a lot to split my db into logical functional areas.
I find myself a lot writing code like this Q :

var dbContext = new Company.MyModule("connectionstring")
var entity= dbContext .Entities;

instead i would like to do something like :
var modulecontext = New Module("MyModule")

Basically the Module Class is like a wrapper around the dbContext , i dont have to define the connection string all the time.

This has the benefit:
-Much more cleaner to read - more closer to mdd concepts
-Is more consistent with the model concepts in the designer
-Dont have to worry about connection strings , Its encapsulated inside the Module class