Azure表存储-列上的where子句可能不存在 [英] Azure table storage - where clause on column that may not exist

查看:59
本文介绍了Azure表存储-列上的where子句可能不存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要在我的azure表中添加一个新列.例如,该表称为用户",新列称为"ComputationDate". 用户"表已经存在,其中的行没有此新列"ComputationDate".我对其有如下查询,

I am adding a new column to my azure table. For ex., the table is called 'User' and the new column is called 'ComputationDate'. The 'User' table already exists with rows that do not have this new column 'ComputationDate'. I have a query over it as follows,

var usersDue = from user in Table.Query where user.ComputationDate != <somedate> select user;

var usersDue = from user in Table.Query where user.ComputationDate != <somedate> select user;

我希望此查询返回未将ComputationDate设置为"somedate"的所有用户行,以及未定义此新的"ComputationDate"列的用户行. 但是查询不会返回后一组用户.它仅返回设置了"ComputationDate"且值不等于"somedate"的行. 有什么方法可以得到我想要的结果,而不必让所有用户都在客户端上对其进行过滤?

I want this query to return all user rows that do not have ComputationDate set to 'somedate' and also user rows that do not have this new 'ComputationDate' column defined. But the query doesn't return the latter set of users. It only returns rows that have 'ComputationDate' set and where the value is not equal to 'somedate'. Is there any way to get the results I desire without having to get all users and filter it on the client?

推荐答案

您似乎正在尝试执行LINQ to SQL查询.

It looks like you're trying to do a LINQ to SQL query.

这可能会更好地满足您的需求:

This may serve your needs better:

var usersDue = from user in Table.Query 
                 where user.ComputationDate != <somedate> 
                    || user.ComputationDate == null
                 select user;

这篇关于Azure表存储-列上的where子句可能不存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆