简体   繁体   English

Linq-to-SQL无法反映一个存储过程中的更改

[英]Linq-to-SQL fails to reflect changes in one stored procedure

I exposed several stored procedures via linq-to-SQL. 我通过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. 关闭并重新开启VS并没有帮助。 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? 这是linq-to-sql中的错误还是我错过了什么?

TIA TIA

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. 我发现最快的方法是删除SP尝试构建(假设你在某处引用它)它将导致构建错误。 Then when you add the SP back in and do a rebuild all it will re-write the metadata 然后,当您重新添加SP并进行重建时,它将重新编写元数据

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. 存储过程逻辑与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. 确认您看到服务器资源管理器中的更改,特别是proc的输出字段( 您可能必须在服务器资源管理器中进行刷新以使其显示 ),然后重新导入并再次编译。

Should work then. 应该工作。

有些时候vs工作室缓存它们并且刷新什么都不做,尝试重新启动vs工作室删除并再次拖入它们。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM