通过WCF传递CategoryAttribute问题
我有一个问题,WCF 在传递实体时似乎不包含类别等属性。
我有一个围绕 EF 实体的类,用于填充胖客户端上的属性网格。
我正在尝试使用 WCF 从服务器检索信息,并在客户端复制属性网格。 我已经测试了代码,并且在主机中,我能够确定实例中元素的类别。
然而,当我从 ASP.NET 站点请求实例时,我似乎无法检索类别信息。 我得到的只是杂项,所以我认为这意味着当我序列化它时,属性会被剥离。
I have a problem with WCF seemingly not including attributes such as Category when passing entities around.
I have a class wrapped around an EF entity, used to populate a property grid on a thick client.
I am trying to retrieve information from the server, using WCF, and to replicate the property grid on the client side. I have tested the code, and in the host, I am able to determine the category of the elements in the instance.
When I request an instance from an ASP.NET site, however, it seems that I cannot retrieve the category information. All I get is, Misc, so I assume that means when I serialize it, the attributes get stripped.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
特定于 .NET 的信息不会在元数据中传递。 因此,在创建您使用 svcutil 或“添加服务引用”创建的代理类时,不会使用该信息。 这就是为什么属性、非默认构造函数、方法或索引器不会出现在代理类中。
您应该尝试不使用此类信息。 但是,如果您确实需要它,您可以将这些类型放入单独的程序集中,并与客户端共享。 这意味着您在更新该程序集时必须更新所有客户端。
Information specific to .NET is not passed in metadata. Therefore, the information is not used in creating the proxy classes that you create using svcutil or "Add Service Reference". This is why attributes, or non-default constructors, or methods, or indexers, do not appear in proxy classes.
You should try to do without this sort of information. However, if you really need it, you can put those types into a separate assembly, and share it with the client. This will mean that you have to update all of your clients when you update that assembly.