Azure table storage - where clause on column that may not exist

风流意气都作罢 提交于 2019-12-22 06:57:51

问题


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;

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?


回答1:


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;


来源:https://stackoverflow.com/questions/20913668/azure-table-storage-where-clause-on-column-that-may-not-exist

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!