locked
Thread block’s on SQLite

    Question

  • My Thread block’s when I run the following code

    public override async  Task<bool?> Delete(ViewModel.AddressViewModel _model)

            {

                var result = await  this.SQLite.DeleteAsync(_model);

                return result > 0;

            }

    The SQLite property is initialized like this

       SQLiteAsyncConnection sqlite = null;

            public override SQLiteAsyncConnection SQLite

            {

                get

                {

                    if (sqlite == null)

                    {

                        sqlite = new SQLiteAsyncConnection("my.db");

                        return sqlite;

                    }

                    return sqlite;

                }

              

            }


    • Edited by Phumurn.Net Wednesday, October 08, 2014 12:59 PM
    Wednesday, October 08, 2014 12:58 PM

Answers

  • got it  I was awaiting an already awaiting thread I changed it to

      public override async  Task<bool?> Delete(ViewModel.AddressViewModel _model)

            {

                var result =  this.SQLite.DeleteAsync(_model);

                return result.Result > 0;

            }

    please extend my explanation so that I have more understanding on Async await process... 

            }

     
    • Marked as answer by Phumurn.Net Wednesday, October 08, 2014 3:50 PM
    Wednesday, October 08, 2014 3:50 PM

All replies

  • got it  I was awaiting an already awaiting thread I changed it to

      public override async  Task<bool?> Delete(ViewModel.AddressViewModel _model)

            {

                var result =  this.SQLite.DeleteAsync(_model);

                return result.Result > 0;

            }

    please extend my explanation so that I have more understanding on Async await process... 

            }

     
    • Marked as answer by Phumurn.Net Wednesday, October 08, 2014 3:50 PM
    Wednesday, October 08, 2014 3:50 PM
  • Hi Phumurn,

    I am glad to hear you have solved this issue. You can refer to async and await to see more information.

    Regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, October 09, 2014 2:08 AM
    Moderator
  • The problem was caused by an empty ViewModel such that SQLite couldn’t accept an empty required    fields . so no problem with the first approach .

    Thursday, October 09, 2014 5:54 PM