/// <summary> /// Execute a command directly sending a json string /// </summary> /// <param name="command"></param> /// <param name="storeName"></param> /// <param name="data"></param> /// <exception cref="ResponseException"></exception> /// <returns></returns> public async ValueTask <List <ResponseJsDb> > DbCommand(DbCommands command, string storeName, string data) { if (Settings.EnableDebug) { Console.WriteLine($"{command} store = {storeName}, data = {data}"); } if (string.IsNullOrEmpty(storeName)) { throw new ResponseException(command.ToString(), "StoreName can't be null", data); } else if (string.IsNullOrEmpty(data)) { throw new ResponseException(command.ToString(), storeName, "Data can't be null"); } else { try { return(await jsRuntime.InvokeAsync <List <ResponseJsDb> >($"MyDb.{command}", storeName, data, Setup.DBName, Setup.Version, Setup.ModelsAsJson)); } catch (Exception ex) { if (Settings.EnableDebug) { Console.WriteLine($"Exception: {ex.Message}"); } throw new ResponseException(command.ToString(), storeName, data, ex); } } }