Quantcast
Channel: ASPNETWebStack Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 7215

Created Issue: The default created MVC controller is strongly coupled with the Model, making it difficult to unit-test [644]

$
0
0

1. Create a simple MVC web app.
2. Add a basic EF code first model.
3. Add a controller based on this model.
Expected:
The auto generated code for the controller uses Repository pattern to talk to the model using "Repository".
More details on repository pattern: http://msdn.microsoft.com/en-us/magazine/dd942838.aspx

Actual :
The auto generated controller manipulates on the EF DBContext classes directly.

User impact:
One of the key goals of MVC pattern is to make the coupling between model/controller and view as less as possible, making the inidvidual components unit testable. Given that, auto-generating code which has strong coupling on DBContext is not acceptable.
Looks like the "MVCScaffolding" Nuget package lets you to create controller which uses "Repository". But as a getting started user, I have no idea about this package. Also using "respository" should be available as one of the default option while creating controllers.


Viewing all articles
Browse latest Browse all 7215

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>