重命名 DataContext 的属性后,停止 LINQ to SQL 重命名它们

发布于 2024-07-18 06:18:45 字数 232 浏览 3 评论 0原文

我的数据上下文中有一个名为 Proveedor 的实体。 为数据上下文生成一个名为 Proveedors 的属性来表示 Proveedor 的集合。 我将其重命名为 Proveedores,这是西班牙语的正确拼写。 但是,一旦我对模型执行任何操作(与 Proveedor 实体无关)并重建它,就会再次将其重命名回 Proveedors。

我不想关闭复数化,只是希望它停止重命名我的重命名:)

谢谢

I got an entity called Proveedor on my Data Context.
A property called Proveedors is generated for the Data Context to represent a collection of Proveedor.
I rename it to Proveedores which is the correct spelling in Spanish.
But as soon as I do anything on the model (not related to the Proveedor Entity) and rebuild it renames it back to Proveedors again.

I don't want to turn off pluralization just want it to stop renaming my renames :)

Thanks

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

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

发布评论

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

评论(2

英雄似剑 2024-07-25 06:18:45

当您对数据模型 dbml 文件进行更改时,Linq to SQL 类将完全从头开始生成。 您对类文件所做的任何修改都将被覆盖。

更改复数规则必须通过更改代码生成来完成,但我不知道这是否可能。


您可以通过右键单击 dbml 设计器窗口中的表并选择属性来更改生成的名称。 有一个名为“名称”的字段,您应该能够使用它来定义自定义名称。

另外:这与这个特定问题没有直接关系,但是如果您想对生成的类添加修改,它们被定义为部分类。 因此,您可以通过创建单独的分部类来向类添加方法。

When you make a change to the data model dbml file, the Linq to SQL classes are generated completely from scratch. Any modifications you make to the class files will be overwritten.

Changing the pluralization rules would have to be done by changing the code generation, but I do not know if this is possible.


You can change the generated name by right-clicking the table in the dbml designer window and selecting properties. There is a field called 'name' with which you should be able to define a custom name.

Also: this is not directly relevant to this particular issue, but if you want to add modifications to the generated classes, they are defined as partial classes. So you could add methods to the classes by creating a separate partial class.

若沐 2024-07-25 06:18:45

你在哪里重命名它? 如果更改生成的 C# 代码,它将被覆盖,就像您所看到的那样。

您需要在 dbml 文件中更改它。 打开该文件。 选择属性,然后打开属性面板并在其中进行更改。

Where are you renaming it? If you change the generated C# code, it will be overwritten just as you've seen.

You need to change it in the dbml file. Open that file. Select the property, and then open the property panel and change it there.

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