IntraWeb下Model-View-Presenter开发实战--传递篇之一(DataTransferObject)
2010-03-05 22:23
288 查看
DataTransferObject http://martinfowler.com/eaaCatalog/dataTransferObject.html
unit IWA.DTO.LoginDTOIntf;
interface
type
ILoginDTO = interface
['{0C0CEEC3-F677-4385-99E0-5EF51B746559}']
function GetUserID: string;
procedure SetUserID(const Value: string);
function GetUserName: string;
procedure SetUserName(const Value: string);
function GetUserPassword: string;
procedure SetUserPassword(const Value: string);
property UserID: string read GetUserID write SetUserID;
property UserName: string read GetUserName write SetUserName;
property UserPassword: string read GetUserPassword write SetUserPassword;
end;
implementation
end.
unit IWA.DTO.LoginDTOImpl;
interface
uses IWA.DTO.LoginDTOIntf;
type
TLoginDTO = class(TInterfacedObject, ILoginDTO)
private
FUserID: string;
FUserName: string;
FUserPassword: string;
function GetUserID: string;
procedure SetUserID(const Value: string);
function GetUserName: string;
procedure SetUserName(const Value: string);
function GetUserPassword: string;
procedure SetUserPassword(const Value: string);
protected
public
end;
implementation
{ TLoginDTO }
function TLoginDTO.GetUserID: string;
begin
Result := FUserID;
end;
function TLoginDTO.GetUserName: string;
begin
Result := FUserName;
end;
function TLoginDTO.GetUserPassword: string;
begin
Result := FUserPassword;
end;
procedure TLoginDTO.SetUserID(const Value: string);
begin
FUserID := Value;
end;
procedure TLoginDTO.SetUserName(const Value: string);
begin
FUserName := Value;
end;
procedure TLoginDTO.SetUserPassword(const Value: string);
begin
FUserPassword := Value;
end;
end.
很简单的DTO.在实际开发中需要也能够扩充。如错误信息集、数据集等。还有就是DTO的序列化在实际开发中要做到的。
unit IWA.DTO.LoginDTOIntf;
interface
type
ILoginDTO = interface
['{0C0CEEC3-F677-4385-99E0-5EF51B746559}']
function GetUserID: string;
procedure SetUserID(const Value: string);
function GetUserName: string;
procedure SetUserName(const Value: string);
function GetUserPassword: string;
procedure SetUserPassword(const Value: string);
property UserID: string read GetUserID write SetUserID;
property UserName: string read GetUserName write SetUserName;
property UserPassword: string read GetUserPassword write SetUserPassword;
end;
implementation
end.
unit IWA.DTO.LoginDTOImpl;
interface
uses IWA.DTO.LoginDTOIntf;
type
TLoginDTO = class(TInterfacedObject, ILoginDTO)
private
FUserID: string;
FUserName: string;
FUserPassword: string;
function GetUserID: string;
procedure SetUserID(const Value: string);
function GetUserName: string;
procedure SetUserName(const Value: string);
function GetUserPassword: string;
procedure SetUserPassword(const Value: string);
protected
public
end;
implementation
{ TLoginDTO }
function TLoginDTO.GetUserID: string;
begin
Result := FUserID;
end;
function TLoginDTO.GetUserName: string;
begin
Result := FUserName;
end;
function TLoginDTO.GetUserPassword: string;
begin
Result := FUserPassword;
end;
procedure TLoginDTO.SetUserID(const Value: string);
begin
FUserID := Value;
end;
procedure TLoginDTO.SetUserName(const Value: string);
begin
FUserName := Value;
end;
procedure TLoginDTO.SetUserPassword(const Value: string);
begin
FUserPassword := Value;
end;
end.
很简单的DTO.在实际开发中需要也能够扩充。如错误信息集、数据集等。还有就是DTO的序列化在实际开发中要做到的。
相关文章推荐
- IntraWeb下Model-View-Presenter开发实战--创建篇之三(Model)
- IntraWeb下Model-View-Presenter开发实战--起始篇
- IntraWeb下Model-View-Presenter开发实战--创建篇之一 (View)
- IntraWeb下Model-View-Presenter开发实战--创建篇之二(Presenter)
- MVC传递Model之TempData、ViewData、ViewBag差别及用途
- APP开发实战54-业务逻辑层设计(Presenter)和数据访问层设计(Model)
- Part 29 - Using data transfer object as the model in mvc
- MVP 模式(Model-View-Presenter)可以说是 MVC 模式(Model-View-Controller)在 Android 开发上的一种变种、进化模式。
- Model View Presenter (MVP) design pattern and data binding
- 在Xamarin开发,使用MessageCenter在ViewModel和View之间传递值
- AspNet MVC4 教学-4:Asp.Net MVC4 利用ViewData.Model传递数据
- MVC控制器传递多个Model到视图,使用ViewData, ViewBag, 部分视图, TempData, ViewModel, Tuple
- MVC到底使用哪种方式传递Model,在ViewData、ViewBag、PartialView、TempData、ViewModel、Tuple之间取舍
- iOS项目开发实战(Swift)—View之间传递数据
- MODEL-View-Presenter(MVP)模式在FLEX下的开发实例
- MVC到底使用哪种方式传递Model,在ViewData、ViewBag、PartialView、TempData、ViewModel、Tuple之间取舍
- MVC控制器传递多个Model到视图,使用ViewData, ViewBag, 部分视图, TempData, ViewModel, Tuple
- iOS项目开发实战(Swift)—View之间传递数据
- MVC数据从Controller传递到View之ViewData & ViewModel
- MVC传递Model之TempData、ViewData、ViewBag区别及用途