将 LINQ 添加到 SQL 后 Properties.Settings 不明确

发布于 2024-09-05 11:05:59 字数 416 浏览 2 评论 0原文

我最近通过在解决方案中创建 LINQ to SQL 项,将数据库链接到我的 C# 服务。当我继续编码时,一切都很好,但后来我突然注意到有 16 个歧义错误。例如

Ambiguity between 'EmailService.Properties.Settings.defaultInstance' and 'EmailService.Properties.Settings.defaultInstance'

,数据库文件决定创建它自己的Setting.Designer.cs;现在,我的 Properties 文件夹中有一个 Settings.Designer.cs 和一个 Settings1.Designer.cs (由 LINQ to SQL 文件创建)。

无论如何,我是否可以更改数据库文件引用其设置的位置,以便删除重复项?

I have recently linked a database to my C# service by creating a LINQ to SQL item in my solution. Everything was fine and dandy as I was continuing to code, but then I suddenly noticed that there where 16 Ambiguity errors. e.g.

Ambiguity between 'EmailService.Properties.Settings.defaultInstance' and 'EmailService.Properties.Settings.defaultInstance'

What happened was that the database file decided to create it's own Setting.Designer.cs; So now I have a Settings.Designer.cs and a Settings1.Designer.cs (which was created by the LINQ to SQL file) in my Properties folder.

Is there anyway that I can change where the database file is referencing its settings so I can delete the duplicate?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(3

瑾夏年华 2024-09-12 11:05:59

我手动修复了它。

我必须使用查找和替换来替换引用 Settings1.settings 的所有实例,因为我无法使用重构;然后我不得不删除 Settings1.settings 文件。

但是,您必须确保不会错过引用,否则在重建解决方案时将自动生成另一个 Settings1.settings。

I fixed it manually.

I had to use find and replace to replace all instances that were referencing to Settings1.settings since I couldn't use refactoring; then I had to delete the Settings1.settings file.

You must however make sure that you do not miss a reference otherwise another Settings1.settings will be automatically generated when you rebuild your solution.

白鸥掠海 2024-09-12 11:05:59

我删除了 Settings1 文件,这似乎已经成功了......

I deleted Settings1 file and that seemed to have done the trick...

故人如初 2024-09-12 11:05:59

在 dbml 设计器的 DataContext 属性中,有一个选项可以使用默认启用的应用程序设置。如果设置为 false,将不再生成设置类。

In the dbml designer, in the DataContext properties, there's an option to use app settings that's enabled by default. If you set it to false, it will no longer generate the settings class.

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