Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/solr/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 移动服务查询异常_C#_Azure_Azure Mobile Services_Query Expressions - Fatal编程技术网

C# 移动服务查询异常

C# 移动服务查询异常,c#,azure,azure-mobile-services,query-expressions,C#,Azure,Azure Mobile Services,Query Expressions,当我将代码与泛型一起使用时: var parenttable = MobileService.GetTable<TParent>(); var testid = await parenttable.Where(prnt => prnt.Id == 20).ToListAsync(); 我发现了一个例外: “Where”移动服务查询表达式“Convert(prnt).Id”中不支持成员“Id” 但如果我将泛型更改为类型: var parenttable =

当我将代码与泛型一起使用时:

    var parenttable = MobileService.GetTable<TParent>();
    var testid = await parenttable.Where(prnt => prnt.Id == 20).ToListAsync();
我发现了一个例外:

“Where”移动服务查询表达式“Convert(prnt).Id”中不支持成员“Id”

但如果我将泛型更改为类型:

   var parenttable = MobileService.GetTable<Category>();
   var testid = await parenttable.Where(prnt => prnt.Id == 20).ToListAsync();
var parenttable=MobileService.GetTable();
var testid=await parenttable.Where(prnt=>prnt.Id==20.toListSync();
我有正常的结果。
为什么?我如何使用泛型?

知道这是一个老问题,但答案是,您必须告诉我们,这个泛型类型也是一个类

where T : class, IEnity
where T : class, IEnity