ASP.NET MVC & Web Services

前端 未结 7 1382
梦谈多话
梦谈多话 2020-12-02 09:30

Does adding a Web Service to my ASP.NET MVC project break the whole concept of MVC?

That Web Service (WCF) depends on the Model layer from my MVC project to communic

7条回答
  •  广开言路
    2020-12-02 09:53

    Separating the Model into it's own project is not breaking the "MVC" pattern. First off, it is just that -- a pattern. The intention of the MVC pattern is to clearly delineate between your data, the data handlers, and the presenters and the way you interface between them. The best way to do it is how Seb suggested:

    • YourApp.Data
    • YourApp.Web.Mvc
    • YourApp.Web.WebService

    Something that might help you out is the MVC Storefront that Rob Conery put together. Go watch the video's here:

    MVC Storefront Video Series

    And if you want to look at the actual code in your browser to quickly see how he did it, go here: MVC Storefront Codeplex Code Browser

提交回复
热议问题