Linq-to-SQL 无法反映一个存储过程中的更改
我通过 linq-to-SQL 公开了几个存储过程。一段时间后,我意识到我需要这些过程再返回一列,因此我更改了过程,在设计板中删除了它们,然后再次拖动。
我确实看到我的所有程序中都公开了新列,除了一个 - 它的辅助类根本没有改变。当我直接执行该存储过程时,我确实看到了新列。
我缺少什么?关闭并重新打开 VS 没有帮助。清洁溶液也没有帮助。唯一真正有效的解决方法是重命名该过程。这是 linq-to-sql 中的错误还是我遗漏了什么?
TIA
I exposed several stored procedures via linq-to-SQL. After some time I realized I needed one more column returned by those procedures, so I changed the procedures, deleted them in the design pad, and dragged again.
I do see the new column exposed in all my procedures except one - its helper class did not change at all. When I execute that stored procedure directly, I do see the new column.
What am I missing? Closing and reopening VS did not help. Cleaning the solution did not help either. The only workaround that actually worked was to rename the procedure. Is this a bug in linq-to-sql or am i missing something?
TIA
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我以前也遇到过这种情况。我发现最快的方法是放弃 SP 尝试构建(假设您在某处引用它),这会导致构建错误。然后,当您重新添加 SP 并重建所有内容时,它将重写元数据
I have run across that before as well. The quickest way I found was to drop the SP attempt a build (assuming you are referencing it somewhere) it will cause build errors. Then when you add the SP back in and do a rebuild all it will re-write the metadata
是的,设计师非常挑剔,尤其是对于存储过程。如果名称和输出字段相同,它实际上不会刷新存储过程的元数据,因为它只关心调用什么以及期望返回什么。存储过程逻辑与L2S无关。
确认您在服务器资源管理器中看到了更改,特别是过程的输出字段(您可能需要在服务器资源管理器中进行刷新才能使其显示),然后重新导入并再次编译。
那时应该工作。
Yes, the designer is pretty picky, especially with stored procs. If the name and the output fields are the same, it doesn't actually refresh the metadata of the stored procedure because all it cares about is what to call and what to expect back. The stored procedure logic is irrelevant to L2S.
Confirm you see the change in server explorer, particularly the output fields of the proc (you may have to do a refresh in server explorer to make it appear), then reimport and compile again.
Should work then.
有时 vs studio 会缓存它们并且刷新不会执行任何操作,请尝试重新启动 vs studio 删除并再次拖入它们。
Some times vs studio caches them and refresh does nothing, try restarting vs studio deleting and dragging in them again.