空的 reference.cs 文件添加服务引用并选中重用类型选项
场景
- Visual Studio 2010
- Silverlight 4
- 实体框架
- 自跟踪实体
问题
在服务器端,我们使用实体框架模型生成实体对象。我们使用自我跟踪 T4 模板来生成实体。这些实体是共享的,可以从客户端使用(Silverlight 4 项目)。
但是当我们尝试添加新的 Web 服务引用时,代理生成器不起作用。 Reference.cs 文件为空。我们已经检查了 Web 参考配置中的“重用类型”选项。我们已经检查了将共享的程序集(仅限实体程序集)。
我们尝试从实体的 DataContract 属性中删除每个 (IsReference=true),但它不起作用。
有什么想法或解决方法吗?
Scenario
- Visual Studio 2010
- Silverlight 4
- Entity Framework
- Self-tracking entities
Problem
On the server side, we have generated entity objects using Entity Framework model. We have used self tracking T4 templates to generate the entities. These entities are shared and can be used from the client side (Silverlight 4 project).
But when we try to add a new Web Service reference, the proxy generator don't work. The reference.cs file is empty. We have checked the option 'Reuse Types' in the configuration of the Web Reference. We have checked the assemblies that will be shared (entity assemblies only).
We have tried to remove every (IsReference=true) from DataContract attributes of the entities but it did not work.
Any idea or workaround?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

取消选中“重用类型”对我有用。代码生成器遍历依赖关系的对象图,如果遇到任何问题,例如找不到引用,那么它就会崩溃并且不会在reference.cs中生成任何代码。
Unchecking the "Reuse Types" worked for me. The code generator walks the object graph of dependencies and if it encounters any problem, like a reference not found, then it blows up and doesn't produce any code in the reference.cs.