在面向服务的架构中开发应用程序时定义服务调用原型/签名的最佳实践是什么?
例如,我想创建服务调用来发送电子邮件。
假设我的域层中有以下对象
[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}
我倾向于第一个选项。(话虽如此,我知道对象是否比传递整个对象本身更复杂。)