简体   繁体   中英

Converting ASP.Net MVC to N-Tier

I recently started learning about ASP.Net MVC and its various features MVC_3_MUSIC_STORE + CODE .
It looks very structured and simple to understand.

I was reading about enterprise applications and how they are layered/tiered in different sections
(logical/physical)

I was wondering(for learning ) how to do separate(convert) the above MVC_3_MUSIC_STORE into n-tier or 3 tier application (since we already have a working example) in order to have a clean separation of concerns. I don't have much prior experience in this.

What changes would be required?

What will be different DTO(s) or POCO(s) that would be needed? The above example uses POCO entities around from controller to views. Would it remain same, assuming EF Code first is used.

Also i was wondering what changes will be required if WCF Webservice is introduced as a data access layer. ieInstead of retrieving data from DAL ,Clients will request data to and from WCF Webservice. Client can be Web app or WinForms or Sliverlight app.
( [DAL <--> WCF WS] <--> N CLIENTS )

Would be interesting to know about various approaches.

Example code would be helpful and/or examples for same.

Edit 1 - Added
One of the things I noticed was when i move the model classes from Model folder to new project "MYMODEL" I will have to again add reference to "System.ComponentModel.DataAnnotations" and "System.Web.Mvc" in new model project?

How can this be avoided? How can these validations be moved to Business layer?

如果转移到新项目,参考将丢失

Edit 2
Looking for something similar to this Advice For A Newbie About N-Tier Applications

Normally the only change that will be required is that you will provide an implementation of the repository (DAL layer) which will call a WCF web service to fetch the domain models from instead of some EF DataContext talking directly to the database. A change completely transparent to Controllers and Views.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM