none
Error querying by PK and RK when no results were found -- normal behavior?

    Question

  • Hello folks,

    I am querying a table in Azure storage by partition key and Row key.

    I know that the entity I’m looking for does not exist in the table.

       Dim Result = (From a In Me.Context.FeatureHeaders
    
           Where a.PartitionKey = CategoryID AndAlso a.RowKey = FeatureHeaderID
    
           Select a).FirstOrDefault
    
    

    I think because the entity does not exist in the table Azure returns an exception.

    Is this normal behavior?

     

    If yes what is the best way to handle this situation?

    This is the error i get:

    <?xml version="1.0" encoding="utf-8" standalone="yes"?>
    <error xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
     <code>ResourceNotFound</code>
     <message xml:lang="en-US">The specified resource does not exist.</message>
    </error>

    Saturday, August 07, 2010 3:49 PM

Answers

  • Yes, this is normal behavior. If you don't want to raise an exception, you can set the IgnoreResourceNotFoundException in the context to true. See issue #1 in http://blogs.msdn.com/b/windowsazurestorage/archive/2010/07/26/how-wcf-data-service-changes-in-os-1-4-affects-windows-azure-table-clients.aspx
    • Marked as answer by LAT3450 Saturday, August 07, 2010 4:04 PM
    Saturday, August 07, 2010 3:56 PM

All replies

  • Yes, this is normal behavior. If you don't want to raise an exception, you can set the IgnoreResourceNotFoundException in the context to true. See issue #1 in http://blogs.msdn.com/b/windowsazurestorage/archive/2010/07/26/how-wcf-data-service-changes-in-os-1-4-affects-windows-azure-table-clients.aspx
    • Marked as answer by LAT3450 Saturday, August 07, 2010 4:04 PM
    Saturday, August 07, 2010 3:56 PM
  • Thanks Fernando.

    Saturday, August 07, 2010 4:05 PM