久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

錯誤,LINQ to Entities 不支持方法

Error, method not supported by LINQ to Entities(錯誤,LINQ to Entities 不支持方法)
本文介紹了錯誤,LINQ to Entities 不支持方法的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

問題描述

為什么我會收到此錯誤:

Why I am getting this error:

LINQ to Entities 不支持方法Single".考慮使用First"方法.

           public ActionResult Details(int id)
Line 27:   {              
             var result = (from d in _db.MovieSet
Line 29:     where d.Id == id
Line 30:     select d).Single();
            //
            //
           } 

代碼編譯安全,但只有在調(diào)用相應(yīng)部分時才會中斷.我是 LINQ 的新手,因此不知道哪些方法適用于 LINQtoSQL 或 LINQtoEntities.這意味著更多的錯誤!我們無法以這種方式記住所有方法.

Code compiles safe, but only breaks if call is made to the respective section. I am new to LINQ, therefore do not know which methods are for LINQtoSQL or LINQtoEntities. This means more errors! We cannot remember all methods this way.

我的問題是,如果適用于某些類型/場景的方法有限制,為什么它們會出現(xiàn)在 Intellisense 中?

My question is, if there are limitations to the methods applicable to certain types / scenarios, why do they appear in Intellisense?

任何有助于了解是否支持的解決方法/技術(shù)?

Any work-around / technique helpful to have an idea if one is supported ?

推薦答案

Microsoft 有一個完整的 Linq to Entities 中支持和不支持的方法列表.去那里可以找到這些信息.

Microsoft has a complete list of supported and unsupported methods in Linq to Entities. That's where to go to find out this information.

您會注意到 SingleSingleOrDefault 方法實際上在分頁方法部分被列為不支持".

You'll notice that the Single and SingleOrDefault methods are in fact listed as "not supported" in the section on Paging Methods.

正如 Jared 所指出的,編譯器在編譯時不知道您使用的是哪個提供程序,因此它無法強(qiáng)制執(zhí)行提供程序可能實現(xiàn)或可能不實現(xiàn)的擴(kuò)展方法的編譯時安全性.您將不得不依賴文檔.

As Jared pointed out, the compiler does not know at compile time which provider you are using, so it has no way to enforce compile-time safety of extension methods that the provider may or may not implement. You'll have to rely on the documentation instead.

這篇關(guān)于錯誤,LINQ to Entities 不支持方法的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

Why shouldn#39;t I always use nullable types in C#(為什么我不應(yīng)該總是在 C# 中使用可空類型)
C# HasValue vs !=null(C# HasValue vs !=null)
C# ADO.NET: nulls and DbNull -- is there more efficient syntax?(C# ADO.NET:空值和 DbNull —— 有沒有更高效的語法?)
How to set null value to int in c#?(如何在c#中將空值設(shè)置為int?)
How to handle nulls in LINQ when using Min or Max?(使用 Min 或 Max 時如何處理 LINQ 中的空值?)
Method call if not null in C#(在 C# 中如果不為 null 的方法調(diào)用)
主站蜘蛛池模板: 亚洲高清免费 | 日本免费在线 | 91在线视频观看免费 | 久久亚洲欧美日韩精品专区 | 欧美一级片在线 | 日韩中文字幕免费在线观看 | 国产精品视频一区二区三 | 欧美精品一区二区三区四区五区 | 高清黄色网址 | 国产欧美一区二区三区另类精品 | 播放一级黄色片 | 欧美综合自拍 | 在线观看亚 | 欧美片网站免费 | 做a视频| 亚洲成人一二区 | 国产成人午夜电影网 | 最新国产精品精品视频 | 精品久久久久久久久久久久久久 | 欧美视频在线观看 | 视频一区二区三区中文字幕 | 久久久久久久久久毛片 | h小视频 | 天天色官网 | 黄色免费网| 久久久影院 | 91热在线 | 国产精品a久久久久 | 男人影音| 免费看黄色片 | 国产精品久久久久久久模特 | 免费成人国产 | 天天躁日日躁狠狠很躁 | 美日韩免费视频 | 亚洲欧美日韩精品久久亚洲区 | 欧美在线一区二区三区 | 精品一区二区在线观看 | 久久精品91久久久久久再现 | 99re6热在线精品视频播放 | 视频一区二区三区中文字幕 | 色毛片 |