Waiting for answer This question has not been answered yet. You can hire a professional tutor to get the answer.

QUESTION

keep getting System.AggregateException: One or more errors occurred. ---gt; System.NotSupportedException: A second operation started on this context...

 keep getting System.AggregateException: One or more errors occurred. ---> System.NotSupportedException: A second operation started on this context before a previous asynchronous operation completed. Use 'await' to ensure that any asynchronous operations have completed before calling another method on this context. Any instance members are not guaranteed to be thread safe.

private async Task getDiscoDeviceDescription(int manufacture) {

  var output = new sqlParameter("@deviceDescription", sqlDbType.NVarChar, 255)

  {

     Direction = ParameterDirection. Output

  };

  await Database.ExecuteSqlCommandAsync("exec storedProcedure @manufacture,@deviceDescription OUT", new sqlParameter("@manufacture", manufacture), output);

  description = (string) output.Value;

  return description;

}

private async Task getPopDeviceDescription(int manufacture, string serialNumber)

{

  var output = new sqlParameter("@deviceDescription", sqlDbType.NVarChar, 255)

  {

     Direction = ParameterDirection. Output

  };

  await Database.ExecuteSqlCommandAsync("exec storedProcedure @manufacture, @serialNumber, @deviceDescription OUT", new sqlParameter("@manufacture", manufacture), new sqlParameter("@serialNumber", serialNumber), output);

  description = (string) output.Value;

  return description;

}

public async Task GetDeviceDescAsync(int manufacture, string serialNumber, Type type)

{

  switch(type)

  {

     case type.Disco:

        return getDiscoDeviceDescription(int manufacture);

     case type.Pop:

        return getPopDeviceDescription(int manufacture, string serialNumber);

  }

}

Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question