元数据中的 WCF 模型类未更新

发布于 2024-12-21 15:05:06 字数 436 浏览 1 评论 0原文

我有一个 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

怪我太投入 2024-12-28 15:05:06

我多次遇到这样的问题,我发现问题与此相关。

  1. 1.当你在DAL中改变时。您必须首先构建该项目。
  2. WCF pproject 作为 DAL 的参考。因此,您还需要构建它并验证它是否已更新 DLL。

现在转到项目并更新服务参考。您使用 WCF 服务的项目或应用程序中的该服务的名称。

I faced such issue in many time and i found problem is related to this.

  1. 1.As you change in DAL. It is neccesarry that you build that project first.
  2. WCF pproject as Reference of DAL. So you need to build this too and verify that it has updated DLL.

Now go to project and update service reference. of that Service in project or application where you consume your WCF service.

弥繁 2024-12-28 15:05:06

有几点:

更新服务引用时,根据所使用的服务有多大,所有属性定义可能不会立即更新。另外,在更新服务参考后,我建议构建项目,然后继续。这似乎避免了之前的问题。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文