开发者

Using WCF with wsHttpBinding with Web Forms vs MVC

开发者 https://www.devze.com 2023-01-16 09:39 出处:网络
I have used WCF in the past with my Webforms so my solution was MyWebformApp= WCF(Model+business) + Web Forms

I have used WCF in the past with my Webforms so my solution was

MyWebformApp = WCF(Model+business) + Web Forms

So when I want to work with the MVC for 开发者_开发技巧presentation arch. How do u use WCF with ASP.net MVC ? Are your data contracts a part of the model ? How do you register the datacontracts as properties?


Roughly here are a few steps:

  1. Create a proxy of the service using svcutil.exe and include it in your application
  2. Create an interface which will abstract all the necessary methods you need to call from the application (IRepository)
  3. Implement this repository and call your WCF service (work with the generated client)
  4. Inject the repository into the controller constructor
  5. In the meantime think about the view models you would set and the mapping between the objects coming from the web service and those view models.
0

精彩评论

暂无评论...
验证码 换一张
取 消