元数据中的 WCF 模型类未更新
我有一个 WCF 服务,它使用 DAL 的单独项目,我有一个引用,并且可以通过该服务访问具有 DAL 的实体对象,如下所示:
[OperationContract]
GeoLocations GetLocations();
这将返回一个 GeoLocations 对象。
问题是我已经更新了 DAL,因为我的数据库已更改,并且我在代码中看到了所有新字段,但是当我在 GeoLocations 上执行“查看源”时,我看到以下文件:
GeoLocations [from metadata]
...这并没有包含任何新字段,并在 IDE 中锁定。
我尝试过清理项目、删除所有 DLL 等,但我仍然看到旧的类。
如何使用新属性更新它?
谢谢。
I have a WCF service that uses a separate project for a DAL, which I have a reference to, and can access the entity objects with the DAL, through the service as such:
[OperationContract]
GeoLocations GetLocations();
This returns a GeoLocations object.
The issue is that I have updated the DAL as my database has changed, and I see all the new fields in the code, however when I do a 'view source' on GeoLocations I see the following file:
GeoLocations [from metadata]
... which doesn't contain any of the new fields, and is locked in the IDE.
I have tried cleaning the project, deleting all the DLL's, etc., but I still see the old class.
How can I update this with the new properties?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我多次遇到这样的问题,我发现问题与此相关。
现在转到项目并更新服务参考。您使用 WCF 服务的项目或应用程序中的该服务的名称。
I faced such issue in many time and i found problem is related to this.
Now go to project and update service reference. of that Service in project or application where you consume your WCF service.
有几点:
更新服务引用时,根据所使用的服务有多大,所有属性定义可能不会立即更新。另外,在更新服务参考后,我建议构建项目,然后继续。这似乎避免了之前的问题。
A couple of things:
When updating the service reference, depending on how large the service is that is being consumed, all the property definitions may not be updated right away. Also, after the service reference has been updated, I recommend building the project and then continuing. This seems to avoid the previous issue.