6

LINQPadを使用してローカルCRM組織のODATAサービスに接続していますが、LINQPadを使用して「参加」を実行する方法や関係をトラバースする方法がわかりません。

これが私のURLです

OrganizationData.svc/New_locationSet?$select=new_state_new_location/new_Region$expand=new_state_new_location

これはブラウザで問題なく動作します。これが私がLINQPadで行っていることです:

from l in new_locationSet
from s in l.new_state_new_location
select s.new_Region

しかし、エラーが発生します:

An expression of type 'LINQPad.User.New_state' is not allowed in a subsequent from clause in a query expression with source type 'System.Data.Services.Client.DataServiceQuery<LINQPad.User.New_location>'.  Type inference failed in the call to 'SelectMany'.

何か案は?LINQPadODataのドキュメントが非常に不足していることがわかりました...

4

1 に答える 1

7

拡張したいものを投影する必要があります。例:

from p in Products
select new {p.Name, CategoryName = p.Category.Name}

また

Products.Select(p => new { p.Name, CategoryName = p.Category.Name})

降伏します

http://services.odata.org/(S(readwrite))/OData/OData.svc/Products()?$expand=Category&$select=Name,Category/Name

LinqPadの[リクエストログ]タブ。

于 2012-06-28T21:02:36.200 に答える