在面向服務的體系結構中開發應用程序時定義服務調用原型/簽名的最佳實踐是什麼?在面向服務的架構中爲服務調用定義方法簽名的最佳實踐是什麼?
例如,我想創建服務調用來發送電子郵件。
讓我們說,我已經在我的領域層以下對象
[datacontract]
public class Email
{
public string To { get; set; }
public string From { get; set; }
public string Message { get; set; }
public string Subject { get; set; }
//I am not going to use this properties in send email method
public string OtherProp1 {get; set;}
public string OtherProp2 {get; set;}
public string OtherProp3 {get; set;}
}
我應該創造這樣
public bool SendEmail(string from,string to, string subject,string message){//My Logic}}
或者
public bool SendEmail(Email myEmail){//My Logic}
我對第一個選項扶着服務方法的簽名。 (說過我知道對象是複雜的方式,而不是傳遞整個對象本身的意義。)
你的意思是'公共bool'? – 2012-08-15 19:11:36
這對於[programmers.se]來說是一個很好的問題,而不是[so]。 – 2012-08-15 19:22:31