我在网上搜索,但没有找到任何解决方案。请帮助我解决这个问题。
问题:我有一个带有azure表存储的webapi,当我查询azure表时,webapi json响应包含partitionkey和rowkey。 我希望我的 Web API 响应被 Azure 表的分区键和行键排除。
当前输出:{"partitionkey":"test","Rowkey":"abc","name":"user","email":"[email protected] ","域":"qwe"}
预期输出: {“名称”:“用户”,“电子邮件”:“[email protected]”,“域名”:“qwe”}
最佳答案
when i query azure table, the webapi json response included with partitionkey and rowkey. i want my web api response excluded with partitionkey and rowkey of azure table.
在从 Azure 表存储中选择实体时,您可以尝试使用查询投影从实体返回一组有限的属性。以下查询供您引用。
TableQuery<EmployeeEntity> EmpQuery = table.CreateQuery<EmployeeEntity>();
var query = (from ep in EmpQuery
where ep.PartitionKey == "pkvalue" && ep.RowKey== "rkvalue"
select new { Fname = ep.FirstName, Lname = ep.LastName}).AsTableQuery();
var emps = query.Execute();
关于azure - 在azure表存储的Web api响应中排除分区键和行键,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40344191/