ASP.NET MVC view model best practices

后端 未结 2 1423
我寻月下人不归
我寻月下人不归 2020-12-30 10:27

My ASP.NET MVC site connects to a WCF service to get data. The WCF service returns a data contract like this:

[DataContract]
public class Person
{
    [Data         


        
2条回答
  •  时光说笑
    2020-12-30 11:10

    I'd say create a Mapper layer that would convert between the WCF Person class and the "mirror" Person class. That way you are tying your MVC implementation to a POCO and not directly to WCF. This adds the ability to swap out WCF with another service without touching MyViewModel in the future if need be (looser coupling).

提交回复
热议问题