コード例 #1
0
        public static IQueryable <UtilityRow> CreateRowQuery(string accountName, string tableName, DbTableDataContext context)
        {
            DbTableRowQueryProvider <UtilityRow> dbTableRowQueryProvider = new DbTableRowQueryProvider <UtilityRow>(context, accountName, tableName);

            if (context.SignedAccountIdentifier != null && (context.SignedAccountIdentifier.StartingPartitionKey != null || context.SignedAccountIdentifier.StartingRowKey != null || context.SignedAccountIdentifier.EndingPartitionKey != null || context.SignedAccountIdentifier.EndingRowKey != null))
            {
                KeyBounds keyBound = new KeyBounds()
                {
                    MinPartitionKey = context.SignedAccountIdentifier.StartingPartitionKey,
                    MinRowKey       = context.SignedAccountIdentifier.StartingRowKey,
                    MaxPartitionKey = context.SignedAccountIdentifier.EndingPartitionKey,
                    MaxRowKey       = context.SignedAccountIdentifier.EndingRowKey
                };
                dbTableRowQueryProvider.SASKeyBounds = keyBound;
            }
            return(new DbTableRowQueryable <UtilityRow>(dbTableRowQueryProvider));
        }
コード例 #2
0
        private T ExecuteQuery <T>(ChangeDescription changeDescription)
        {
            ((DbTableRowQueryProvider <T>)changeDescription.QueryableRow.Provider).CheckForReadPermission = false;
            DbTableRowQueryProvider <T> provider   = (DbTableRowQueryProvider <T>)changeDescription.QueryableRow.Provider;
            IEnumerator <T>             enumerator = provider.Execute <IEnumerator <T> >(changeDescription.QueryableRow.Expression);

            if (!enumerator.MoveNext())
            {
                return(default(T));
            }
            T current = enumerator.Current;

            if (enumerator.MoveNext())
            {
                throw new DataServiceException(400, "Multiple objects match the query");
            }
            return(current);
        }