public static ActionTask AsyncExecuteReader(this MySqlCommand cmd, TaskChain ch, Action <MySqlDataReader> readerReady) { return(ch.AddTask(() => { ch.AutoCallNext = false; cmd.InternalExecuteReader(subtable => { //this method is respond for call next *** ch.AutoCallNext = true; //** //fetch data while (subtable.InternalRead()) { readerReady(subtable); if (subtable.StopReadingNextRow) { break; } } // subtable.Close(() => { }); // if (ch.AutoCallNext) { ch.Next(); } }); })); }
public static ActionTask AsyncExecuteScalar <T>(this MySqlCommand cmd, TaskChain ch, Action <T> resultReady) { return(ch.AddTask(() => { ch.AutoCallNext = false; cmd.ExecuteScalar <T>(result => { ch.AutoCallNext = true; resultReady(result); if (ch.AutoCallNext) { ch.Next(); } }); })); //not use autocall next task, let the cmd call it when ready *** }
public static ActionTask AsyncExecuteSubTableReader(this MySqlCommand cmd, TaskChain ch, Action <MySqlDataReader> readerReady) { return(ch.AddTask(() => { ch.AutoCallNext = false; cmd.InternalExecuteSubTableReader(subtable => { //this method is respond for call next *** ch.AutoCallNext = true; readerReady(subtable); if (ch.AutoCallNext) { ch.Next(); } }); })); //not use autocall next task, let the cmd call it when ready *** }
public static ActionTask AsyncExecuteSubTableReader(this MySqlCommand cmd, TaskChain ch, Action<MySqlDataReader> readerReady) { return ch.AddTask(() => { ch.AutoCallNext = false; cmd.ExecuteSubTableReader(subtable => { //this method is respond for call next *** ch.AutoCallNext = true; readerReady(subtable); if (ch.AutoCallNext) { ch.Next(); } }); }); //not use autocall next task, let the cmd call it when ready *** }
public static ActionTask AsyncExecuteScalar(this MySqlCommand cmd, TaskChain ch, Action<object> resultReady) { return ch.AddTask(() => { ch.AutoCallNext = false; cmd.ExecuteScalar(result => { ch.AutoCallNext = true; resultReady(result); if (ch.AutoCallNext) { ch.Next(); } }); }); //not use autocall next task, let the cmd call it when ready *** }