c# - 无法使用 C# 获取 blobstorage 表中的行列表
问题描述
我正在尝试通过传递列名和值来返回行列表。代码如下所示
public List<SecuritySchema> GetSecuritySchemaDetailsByProjectId(int id)
{
CloudTable cloudTable = GetCloudTable();
TableQuery<SecuritySchema> securitySchemas = new TableQuery<SecuritySchema>()
.Where(TableQuery.GenerateFilterCondition(Constants.SecuritySchema.PROJECTID_COLUMN_NAME,
QueryComparisons.Equal, id.ToString()));
var securitySchemaDetail = cloudTable.ExecuteQuery(securitySchemas).ToList();
return securitySchemaDetail;
}
但计数显示为 0。但在表中我有 2 行。我在域类中使用 int 作为 ProjectId。
请帮我整理一下。
解决方案
只是总结罗曼的评论来回复以帮助其他有同样问题的人。
仔细检查表存储中列的类型。
如果它存储为 anInt32
那么你必须使用GenerateFilterConditionForInt
方法而不是GenerateFilterCondition
.
GenerateFilterCondition
:为字符串值生成一个属性过滤条件字符串。
GenerateFilterConditionForInt
:为 Int32 值生成属性过滤条件字符串。
推荐阅读
- three.js - How to preserve threejs texture scale while applying texture rotation
- princexml - Prince 是否支持边缘索引/出血标签?
- css - Animated resizing of a Grid with Material UI React
- openshift - Cannot add hostPath to under volumes in custom SCC
- python - 如何根据 JSON 响应更改 Python 变量?
- cmake - CMake Error : No externals download dir set
- angular - Angular Routing not working when adding ID as a parameter in URL
- discord.js - Discord.js 支持频道
- android - 从 javac 引用 aar 的最佳方法是什么?
- sql - HIVE-SQL_SERVER:HadoopExecutionException:此行中的列不足