VS2008下的dmbl设计器文件有bug?
今天我一直在努力处理 linq2sql dbml 设计文件。当我开始并将桌子放在设计师身上时,一切都很好。我修改命名空间并关闭数据上下文的连接字符串属性。然后我想创建 linq 实体的部分扩展。所以我在文件设计器上按了 F7。此时一切也都很酷了。然后,当我更改数据库架构的某些内容时,我返回并添加另一个表或删除并重新添加旧表,MyContext.dbml 会丢失其下面的 MyContext.design 文件。另外 2 个(.cs 和 .layout 仍然存在)。自然地,它破坏了我从头开始所需的一切。很烦人。有什么想法吗?
I had been struggling today with the linq2sql dbml design files. When I start out and place my tables on the designer everything is OK. Them I modify the namespaces and turn off the connection string properties for the data context. Then I want to create partial extensions of my linq entities. So I hit F7 on the files designer. At this point everything is cool too. Then when I change something with the DB's schema I go back and add another table or delete and re-add an old one, the MyContext.dbml loses the MyContext.design file underneath it. The other 2 (the .cs and the .layout are still there). Naturally it breaks everything I need to start from scratch. Very annoying. Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
啊!是的!你用的是VS2008吧?
这是一个已知的错误,实际上,您的
using
指令位于partial
类的您的一半中的位置实际上很重要......很糟糕,并且扔掉设计师文件...
没关系!
此仅适用于您拥有
SomeName.dbml
和SomeName.cs
的情况,因此另一个修复方法是重命名该文件。这在 VS2010 中已修复。疯了,是吧?Ah! Yes! You're using VS2008, right?
This is a known bug, and it actually matters where your
using
directives are in your half of thepartial
class...is bad, and trashes the designer file...
is fine!
This only applies when you have
SomeName.dbml
andSomeName.cs
, so another fix is to rename the file. This is fixed in VS2010. Crazy, huh?您应该将您的类保存在单独的文件中。 C# 编译器不关心部件在哪里,因此这是一个简单的解决方法。
此外,如果您将类写入生成的文件(您的帖子中不是很清楚),那么这不是一个错误,而是一个期望的行为。
You should keep your classes in separate file/files. C# compiler doesn't care where parts are so this is a simple workaround.
Besides if you wrote your classes to the generated file(it isn't very clear in your post) then this is not a bug, but a desired behaviour.