2017-06-02 51 views
0

問題:以上是EF-Core 1.1中的可能嗎?我在嘗試以下,但VS2015在線Select new TestViewModel{...}抱怨與錯誤:name Select does not exist in the current context。如果以上情況不可行,那麼使用include(...)時,什麼是解決方法? 注意Customers連接到AddressesOrdersEF-Core LINQ JOIN with include()

var qry = from c in _context.Customers.Include(t => t.Addresses).Where(c => c.Region== "NW").OrderBy(c => c.Name) 
join ord in _context.Orders on c.CustomerID equals ord.CustomerID 
Select new TestViewModel 
{ 
    CustName = c.Name, 
    CustRegion = c.Region, 
    OrderType = ord.Type, 
    .... 
}; 
+1

選擇應該小一點(「選擇」) – Evk

+0

@Evk謝謝。這是我的不好。我沒有注意拼寫,而是開始關注在join中使用'Include(...)'的可能問題。如果其餘的都可以,我會讓你知道的。然後,您可能需要將您的評論更改爲回覆 - 並將其標記爲「答案」。 – nam

+0

@Evk其餘的工作。再次感謝。爲了其他讀者的利益,您可能希望將您的評論轉換爲回覆,並將其作爲「答案」。 – nam

回答

2

select是關鍵字和關鍵字是區分大小寫的。就像你不能聲明類Public Static - 你不能使用Select