What’s problem ?
1.store procedure is too heavy
2.Data access ,Business layer , service seems didnothing
3.UI is too heavy !
4.Hard to test !
As these weaknesses , these codes are very hard to maintain andextension .
Any solution ? maybe we can consider to refactor the architecture ! we need to make different layer do proper things !
Now Let’s Apply this Architecture into the sample!
Let’s go through a Very sample feature , there is 2 drop down list control in aspx page, then I need to display the products by customer type :
1. Member (can have discountprice)
2. Non member (originalprice)
To implement this feature ,let’s see the new architecture :
Nowwhat’s changed ?
1. With presenter , UI not “fat” any more
2. Each layercan be tested
3. With EntityFramework , store procedure cannot be too “fat”
4. Service layer,Business layer, Data Access layer all have been assigned proper responsibilities,which makes maintainable and easy to be extended.