我想了解一些使用WCF合同的最佳做法。我有一個POCO實體類如下圖所示:WCF數據合同中的EF導航屬性
public class Job : IOwnerEntity<int>, ILoggableEntity
{
public int JobID { get; set; }
public int JobtypeCodeID { get; set; }
public string JobName { get; set; }
public int CustomerID { get; set; }
public int JobStatusID { get; set; }
public DateTime CreationDate { get; set; }
public DateTime ModifiedDate { get; set; }
public virtual Customer Customer { get; set; }
public virtual ICollection<JobUserAssignment> JobUsers { get; set; }
public int OwnerEntityID
{
get
{
return JobID;
}
set
{
JobID = value;
}
}
}
現在,當我創建了相應的數據合同,是它推薦給(這裏JobUserAssignment和客戶),包括在datacontract導航性能..?詳細說明,以下哪些合約是推薦的方式?
[ServiceContract]
interface IJobService
{
Job GetJob(int id);//Gets job + job.Customer + job.JobUsers
}
或
[ServiceContract]
interface IJobService
{
Job GetJob(int id);//Gets onlyjob
Customer GetCustome(int jobid);
JobUserAssignment[] GetUsers(int jobid);
}
由於提前,
普拉迪普