示例#1
0
        static void SelectDataBack(MySqlConnection conn, TaskChain tc)
        {
            string sql = "select * from test001";
            var    cmd = new MySqlCommand(sql, conn);

            tc.AddTask(() =>
            {
#if DEBUG
                conn.dbugPleaseBreak = true;
#endif
            });

            //this is very basic mapper***
            var mapper = Mapper.Map((SimpleInfo t, int col_id, string col2, string col3) =>
            {
                t.col1 = col_id;
                t.col2 = col2;
            });

            cmd.AsyncExecuteSubTableReader(tc, reader =>
            {
                mapper.DataReader = reader;
                while (reader.Read())
                {
                    var simpleInfo = mapper.Map(new SimpleInfo());
                }

                ////simple map query result to member of the target object
                ////we create simpleinfo and use mapper to map field


                tc.AutoCallNext = reader.CurrentSubTable.IsLastTable;
            });
        }
        static void SelectDataBack(MySqlConnection conn, TaskChain tc)
        {
            string sql = "select * from test001";
            var    cmd = new MySqlCommand(sql, conn);

            tc.AddTask(() =>
            {
#if DEBUG
                conn.dbugPleaseBreak = true;
#endif
            });

            //this is very basic mapper***
            var mapper = Mapper.Map((SimpleInfo t, int col_id, string col2, string col3) =>
            {
                t.col1 = col_id;
                t.col2 = col2;
            });


            cmd.AsyncExecuteSubTableReader(tc, reader =>
            {
                mapper.DataReader = reader;
                while (SharpConnect.MySql.SyncPatt.MySqlSyncPattExtension.Read(reader))
                {
                    var simpleInfo = mapper.Map(new SimpleInfo());
                }
                tc.AutoCallNext = reader.CurrentSubTable.IsLastTable;
            });
        }
示例#3
0
        static void InsertData(MySqlConnection conn, TaskChain tc)
        {
            string sql = "insert into test001(col1,col2,col3,col4) values(10,'AA','123456789','0001-01-01')";
            var    cmd = new MySqlCommand(sql, conn);

            cmd.AsyncExecuteNonQuery(tc);
            tc.AddTask(() =>
            {
                var lastInsertId = cmd.LastInsertedId;
            });
        }
示例#4
0
 private async Task ToggleVisibilityAsync()
 {
     UpdatePosition();
     try
     {
         if (_isVisible)
         {
             await _transitions.AddTask(HideAsync);
         }
         else
         {
             await _transitions.AddTask(ShowAsync);
         }
     }
     catch (Exception e)
     {
         _logger.LogWarn(LogEvents.UiOpErr, "Visibility transition failed!", e);
         e.Notify();
     }
 }