向实体框架支持的域服务添加其他实体 [英] Adding additional entities to a Entity Framework backed Domain Service
问题描述
我们正在调查使用RIA服务(7月09日预览)来公开现有EF模型的部分内容。我们已经在我们的Web应用程序中添加了一个域服务类,并指定了EF模型,以便使用并选择我们希望通过域服务提供的一些实体(有些启用了编辑功能,大多数不实现)。
We're investigating using RIA Services (July 09 Preview) to expose parts of an existing EF model. We've added a Domain Service class to our web application and specified the EF model to use and selected a few of the entities we wish to make available via the domain service (some have editing enabled, most do not).
我们构建一切都很棒,但是如果我们要向域服务添加一个附加实体,我们该如何做。是否删除您当前的类并重新添加,当RIA服务命中RTM时,此漏洞将被插入?
We build and everything is great, but if we want to add an additional entity to the domain service how do we do that. Is it a case of delete your current class and re-add and this hole will be plugged when RIA Services hits RTM?
推荐答案
我同意,每次数据库更改时,都会手动输入所有这些操作。我最终做的是创建一个新的临时域服务类(和元数据),并将代码剪切并粘贴到现有域服务中,然后从项目中删除临时服务。
I agree, that's annoying to type in all that manually every time the DB changes. What i end up doing is creating a new temporary domain service classes (and metadata) and cut&pasting the code into the existing domain service and then removing the temp service from the project.
另一个选项可以是(没有尝试)使生成的文件成为一个部分类,将所有新的查询都放在一个单独的文件中,每当DB Schema发生更改只是吹灭生成的文件,并使用向导重新创建它。只是一个想法
Another option can be (didn't try it) to make the generated file a partial class, put all the new queries into a separate file and every time the DB Schema changes just blow away the generated file and recreate it using the wizard. Just a thought
这篇关于向实体框架支持的域服务添加其他实体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!