Ok, there are tons of examples using unit of work with dependency injection for Code First, using generic repositories and all that good stuff.
Does anyone have an example doing this with Database First (edmx with dbContext Generator (T4)), Stored Procedures as Function Imports, Unit of Work with dependency injection.
The context for code first or dbfirst will be the same (DbContext).
Stored procedures are mapped in your repository instead of calling context.Customers you call context.Database.Query("Proc_whatever").
Is there a specific spot you want help on, I may have a code sample for it, but everything above is done the same way as the di, code first, generic repositories, etc. The only change to implement a UnitOfWork is to ensure your repositories don't call SaveChanges, you have a method on your UnitOfWork interface called Save() that in turn calls save changes.
I'll update the code at https://github.com/adamtuliper/EF5-for-Real-Web-Applications to include a unit of work. I dont like the implementation though, something doesn't feel right, and thus is leading me more towards CQRS I believe.
So the idea here is: Inject IUnitOfWork IUnitOfWork contains an IContext which is also injected and mapped to a Context. IUnitOfWork maps to UnitOfWork concrete implementation. UnitOfWork concrete implementation references the repositories:
This is partially off the top of my head, so excuse any compilation errors, it's to show in principle
To use a proc, in the CustomerRepository you'd do the following: