azure - 在azure表存储的Web api响应中排除分区键和行键

标签 azure asp.net-web-api2 azure-storage azure-table-storage

我在网上搜索,但没有找到任何解决方案。请帮助我解决这个问题。

问题:我有一个带有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/

相关文章:

azure - Azure API 管理中的 AWS Lambda 授权方相当于什么?

java - 使用 Azure 构建管道时,从 JaCoCo 中排除多模块 Maven 项目中的测试目录

asp.net-mvc - 如何以及在何处使用Web API2和MVC 5应用程序

azure-storage - Azure 存储未显示在 Visual Studio 2015 服务器资源管理器中

ios - 当我在 Swift 中调用 AZSCloudBlob 时,Azure 存储中断

Azure ARM 模板不同的资源组

azure - 使用数据工厂移动文件时如何在目标中保留文件的原始名称?

c# - 在 Web API 2 中创建更新方法

asp.net - 我可以配置 Controller 来拒绝所有 Post 方法吗?

Azure Key Vault 与存储加密