简体   繁体   English

是否可以在Visual Studio 2017的直接窗口中使用数据上下文?

[英]Is it possible to use a Data context in the immediate window of Visual Studio 2017?

I'm trying to debug C# Linq 2 SQL code, and i'm getting a "System.NotSupportedException" exception when using Last() on a table. 我正在尝试调试C#Linq 2 SQL代码,并且在表上使用Last()时遇到“ System.NotSupportedException”异常。 Is it not possible to use this operator in the Immediate windows of Visual Studio 2017? 在Visual Studio 2017的即时窗口中无法使用此运算符吗?

I just tried a quick test using LinqPad and can confirm that Linq to SQL does not have a translation for .Last() , instead it throws an exception with the message "The query operator 'Last' is not supported." 我刚刚使用LinqPad进行了快速测试,并且可以确认Linq to SQL没有.Last()的转换,相反,它抛出异常,消息为“不支持查询运算符'Last'。”

If you have a incremental type primary id such an integere or another field that's indexed and easy to order by, instead perhaps try doing a .OrderByDescending(x => x.id).First() 如果您具有增量类型的主ID,例如整数或其他易于索引的字段,则可以尝试执行.OrderByDescending(x => x.id).First()

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

相关问题 C#是否可以在Visual Studio中测试是否使用即时窗口的语句? - C# Is it possible to testing if statement using immediate window in visual studio? 如何在C#的立即窗口的Visual Studio 2017中加载SOS? - How can I load SOS in Visual Studio 2017 in Immediate Window in C#? 在VS2017中是否可以使用c#“交互式窗口”代替即时窗口 - Is it possible to use the c# “interactive window” instead of the immediate window in VS2017 如何在Visual Studio 2017中使用“C#Interactive”窗口查询“数据连接”中的源代码 - How can I use, in Visual Studio 2017, the “C# Interactive” window to query a source in my “Data Connections” Visual Studio 2013立即窗口和缓慢搜索 - Visual studio 2013 immediate window and searching slow 在Visual Studio立即窗口中清除堆栈 - Clear Stack in Visual Studio Immediate Window 将XmlReader XML写入Visual Studio中的即时窗口? - Write XmlReader XML to immediate window in Visual Studio? 在Visual Studio即时窗口中自动执行命令 - Automate a command in Visual Studio Immediate Window 是否可以将Crystal Reports 2008与Visual Studio 2017一起使用? - Is it possible to use Crystal Reports 2008 with Visual Studio 2017? 打印数组的内容(代码是一行,用于visual studio的立即窗口) - Print the contents of an array (code is one line, for use in Immediate window of visual studio)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM