SOA和WCF数据服务
问题描述:
我想为我的下一个项目使用SOA架构。另外,我想使用WCF数据服务进行数据访问层。例如,用户想要接收某个日期的文档。我们所说的WCF服务(服务层)来检索文件SOA和WCF数据服务
public ActionResult GetDocumentByDate(DateTime date)
{
var request = // here create request object;
var documentsDto = _documentService.GetDocument(request);
...
}
在WCF服务,我们称之为bussines层(BL):
public class DocumentService:IDocumentService
{
public IEnumerable<DocumentDto> GetDocumentsByDate(DocumentsByDateRequest request)
{
// call GetDocumentsByDate from DocumentLogic
}
}
public class DocumentLogic
{
public IEnumerable<Document> GetDocumentsByDate(DateTime date)
{
// call DAL
}
}
我想使用WCF数据服务获取数据。我没有和这个技术合作过。
将WCF数据服务隐藏在服务层后面或它们应该可用,只是SL通过WCF数据服务访问数据是一种很好的做法?
在这种情况下,外界会看到WCF服务和WCF数据服务。
按照这个例子,哪里更好地进行验证?
最后,总的问题是,您对WCF数据服务的印象如何?
答
我认为DataServices是一项很酷的技术,但我认为隐藏它们不是一个好主意。其实你并没有真正隐藏服务,你只是不明确地调用。如果你想使用数据服务,你可以从你的asp.net代码中调用服务。如果你想要的话,你可以使用dataservice中的特定方法来管理和限制你的数据(实体)..因为我猜你正在使用EF :)
我认为最好的地方做验证是在你的asp.net代码在创建课程的请求之前)。