小弟登录专门为回答大侠问题
Data Transfer Object
When you're working with a remote interface, such as Remote Facade , each call to it is expensive. As a result you need to reduce the number of calls, and that means that you need to transfer more data with each call. One way to do this is to use lots of parameters. However, this is often awkward to program - indeed, it's often impossible with languages such as Java&CSharp that return only a single value.
The solution is to create a Data Transfer Object that can hold all the data for the call. It needs to be serializable to go across the connection. Usually an assembler is used on the server side to transfer data between the DTO and any domain objects.
详细资料可以参考下边:
http://en.wikipedia.org/wiki/Data_transfer_object
http://msdn.microsoft.com/en-us/library/ms978717.aspx
http://martinfowler.com/eaaCatalog/dataTransferObject.html
以前对DTO有所了解,只知道不包含逻辑代码,只是对下面的类型是不是DTO类型存有疑惑:
public class UserInfo
{
public int UserID { get; set; }
public string UserName { get; set; }
public Collection<Friend> Friends { get; set; }
}
@artwl:
我觉得是,你觉得呢,向@dudu老大求救啊
@麦田里的守望者:
我也觉得是
看看 Martin Fowler的 企业应用架构模式