Windows Azure Table Storage 解决 Guid 查询问题
在使用 Windows Azure Table Storage 的 CloudTableClient 对Azure 进行数据查询时,会发现在自定义类的Guid类型始终无法去成功查询出数据,对比发现 Guid 值是一致的,最初代码如下:
public UserEntity GetUserByToken(string token)
{ var table = AzureTableContext.CloudTableClientContext.GetTableReference(UserEntity.TableName);
var query =
new TableQuery<UserEntity>()
.Where(TableQuery.GenerateFilterCondition(
"Token",
QueryComparisons.Equal,
token));
return table.ExecuteQuery(query).FirstOrDefault();
}
修改 TableQuery.GenerateFilterCondition 为 TableQuery.GenerateFilterConditionForGuid,修改后代码如下:
public UserEntity GetUserByToken(string token)
{
var table = AzureTableContext.CloudTableClientContext.GetTableReference(UserEntity.TableName);
var query =
new TableQuery<UserEntity>()
.Where(TableQuery.GenerateFilterConditionForGuid(
"Token",
QueryComparisons.Equal,
Guid.Parse(token))); return table.ExecuteQuery(query).FirstOrDefault();
}
最终得以通过Guid查询数据
Windows Azure Table Storage 解决 Guid 查询问题的更多相关文章
- Windows Azure Table storage 之 动态Table类 DynamicTableEntity
在一般情况下,当我们在.net中使用Azure table storage的时候都会为该表建立一个TableEntity的派生类,如下所示. public class CustomerEntity : ...
- 自定义 Azure Table storage 查询过滤条件
本文是在Azure Table storage 基本用法一文的基础上,介绍如何自定义 Azure Table storage 的查询过滤条件.如果您还不太清楚 Azure Table storage ...
- Azure Table Storage(一) : 简单介绍
Azure Table Storage是什么: Azure Table Storage是隶属于微软Azure Storage这个大服务下的一个子服务, 这个服务在Azure上算是老字号了, 个人大概在 ...
- Azure Table storage 基本用法 -- Azure Storage 之 Table
Azure Storage 是微软 Azure 云提供的云端存储解决方案,当前支持的存储类型有 Blob.Queue.File 和 Table,其中的 Table 就是本文的主角 Azure Tabl ...
- Azure Table storage 之改进DynamicTableEntity类为其添加动态语言扩展
在之前的一篇文章中提到,storage类库中包含一个可以用来动态获取Azure table storage 表结构的类-DynamicTableEntity. 我们可以通过这个类,我们无需为每一个表提 ...
- [Windows Azure] How to use the Windows Azure Blob Storage Service in .NET
How to use the Windows Azure Blob Storage Service in .NET version 1.7 version 2.0 This guide will de ...
- Windows Azure Storage (6) Windows Azure Storage之Table
<Windows Azure Platform 系列文章目录> 最近想了想,还是有必要把Windows Azure Table Storage 给说清楚. 1.概念 Windows Azu ...
- [Windows Azure] How to use the Table Storage Service
How to use the Table Storage Service version 1.7 version 2.0 This guide will show you how to perform ...
- [Windows Azure] .NET Multi-Tier Application Using Storage Tables, Queues, and Blobs - 1 of 5
.NET Multi-Tier Application Using Storage Tables, Queues, and Blobs - 1 of 5 This tutorial series sh ...
随机推荐
- php.ini与php-fpm.conf配置文件的区别
php-fpm.conf是PHP-FPM特有的配置文件 php.ini是所以php模式中必须的配置文件 两者的区别是,php-fpm.conf是PHP-FPM进程管理器的配置文件,php.ini是PH ...
- shell中 if else以及大于、小于、等于逻辑表达式介绍
比如比较字符串.判断文件是否存在及是否可读等,通常用"[]"来表示条件测试. 注意:这里的空格很重要.要确保方括号的空格.笔者就曾因为空格缺少或位置不对,而浪费好多宝贵的时间. i ...
- ListView控件的Insert、Edit和Delete功能(第一部分)
摘自:http://blog.ashchan.com/archive/2007/08/28/listview-control-insert-edit-amp-delete-part-1aspx/ Li ...
- 8.4 sikuli 集成进eclipse 报错:Unsupported major.minor version 51.0
8.3中的问题Win32Util.dll: Can't load 32-bit .dll on a AMD 64 bit platform 解决之后,执行还是会有报错:Unsupported maj ...
- 【jsp网站计数功能】 application session
在jsp页面中实现网站计数器的方法有很多,其中比较普遍的做法是利用application 和session对象.application对象可被所有用户共享:session是单用户共享,用户从访问系统开 ...
- Lua 迭代器
第一种:lua迭代器的实现依赖于闭包(closure)特性 1.1 第一个简单的写法 --迭代器写法 function self_iter( t ) local i = 0 return functi ...
- liunx 定时执行 php文件
which php 寻找php路径
- webservice接口调用存储过程返回失败
poka.cashman.timer.service.impl.PdaOperateServiceImpl - Method Name: cashBoxOutOrIn; cbInfo:JN002015 ...
- nagios安装全过程
Nagios是一个用来监控主机.服务和网络的开放源码软件,可以在发生故障时发送报警短信和邮件,只要Nagios监控的对象发生故障,系统就会自动发送短信到手机上.所以应用十分广泛. Nagios is ...
- CodeForces--TechnoCup--2016.10.15--ProblemA--Transformation: from A to B
http://codeforces.com/contest/727/problem/A Transformation: from A to B time limit per test 1 second ...