c# - unable to handle Amazon.DynamoDBv2.Model.ConditionalCheckFailedException -


when execute following code amazon.dynamodbv2.model.conditionalcheckfailedexception not catching.

button click

public delegatecommand savecommand {     {     _savecommand = new delegatecommand(async (arg) => { await      this.savecommandexecuted(arg); }, this.savecommandcanexecute);     return _savecommand;   }    set   {    _savecommand = value;    onpropertychanged("savecommand");    }  } 

save method content

        public async task savecommandexecuted(object parameter)                 {               try                      {                                                            await patientdatasource.instance.savepatient(patient);                       }          catch (amazon.dynamodbv2.model.conditionalcheckfailedexception ex)          {                           exception = ex.message;          }                 } 

database operation method

public async task savepatient(patient patient)    {  var context = commonutils.instance.dynamodbcontext;               try  {    patient.patientid = 1;    await context.saveasync<patient>(patient);  }  catch(amazon.dynamodbv2.model.conditionalcheckfailedexception ex)  {    throw ex;  }             } 

can please advice.

dynamodbcontext (the equivalent of dynamodbmapper in .net sdk) conditions on version attribute of orm object, in your case, patient class, , on else in dynamodboperationconfig. fact unable catch conditionalcheckfailedexception suggests not have concurrent writes happening on same patient. please see this post details.


Comments

Popular posts from this blog

Android : Making Listview full screen -

javascript - Parse JSON from the body of the POST -

javascript - Chrome Extension: Interacting with iframe embedded within popup -