我一直在使用以下代码将"Odata"样式参数注入查询.这工作正常,直到我尝试使用$ expand,我得到一个转换错误
无法转换类型的对象'System.Data.Entity.Infrastructure.DbQuery 1[System.Web.Http.OData.Query.Expressions.SelectExpandBinder+SelectAllAndExpand1 [STOS.Repository.Entities.Item]]'为类型'System.Collections.Generic.IEnumerable`1 [STOS.Repository.Entities.Item]' .
public static List<T> ApplyTo<T>(HttpRequestMessage request, IQueryable<T> query)
{
var context = new ODataQueryContext(TheEdmModel(), typeof(T));
var newOptions = new ODataQueryOptions<T>(context, request);
return ((IEnumerable<T>)newOptions.ApplyTo(query)).ToList();
}
Run Code Online (Sandbox Code Playgroud)
我知道当使用$ expand时,会返回一个不同的包装类,但是如何将其转换为List?
我已经为2013安装了TFS Power Tools.但是如何访问powershell命令.
该文件建议使用
Add-PSSnapin Microsoft.TeamFoundation.PowerShell
Run Code Online (Sandbox Code Playgroud)
这给出了错误:
Add-PSSnapin:此计算机上未安装Windows PowerShell管理单元"Microsoft.TeamFoundation.PowerShell".