0

Patitionkey と Rowkey を使用して、Azure テーブルから単一のエンティティを取得しようとしています。ここで直面している問題は、一致する Partitionkey または Rowkey がない場合に null を返さないことです。

MyRecordsTable specificEntity =
            (from e in serviceContext.CreateQuery<MyRecordsTable >("MyRecordsTable ")
             where e.PartitionKey == pkey && e.RowKey == rkey
             select e).FirstOrDefault();

次のリンクを参照しましたが、一致しない場合は null を返す必要があると書かれています。しかし、例外が発生しています ( An error occurred while processing this request.) 内部例外はNo resource found.

http://www.windowsazure.com/en-us/develop/net/how-to-guides/table-services/#header-11

4

1 に答える 1

3

これは、REST 駆動型データ ソースのデフォルトの動作です。見つからない場合は、HTTP 404 エラーが返されます。代わりに NULL を取得する場合は、IgnoreResourceNotFoundExceptionプロパティを使用して true に設定する必要があります。

于 2012-10-06T13:45:53.203 に答える