Пример #1
0
        //[TestMethod]
        public void TestCallback()
        {
            Parallel.For(0, 5000, (i) =>
            {
                using (var localConnection = new GreedyConnection(conStr, str => new MySqlConnection(str)))
                {
                    localConnection.Bind(state =>
                    {
                        Debug.WriteLine("{0}:{1}", state.CommandText, state.Parameter == null ? "" : state.Parameter.GetType().FullName);
                    });

                    var person = new Person()
                    {
                        Name = "TestInsertStrongClassInstanceName", Age = rand.Next(1, 100), Address = "TestInsertStrongClassInstanceAddress", Enabled = true
                    };

                    var count = localConnection.Insert <Person>(person);
                    localConnection.Unbind();
                }
            });
        }
Пример #2
0
        //[TestMethod]
        public void TestCallback()
        {
            Parallel.For(0, 5000, (i) =>
            {
                using (var localConnection = new GreedyConnection(conStr, str => new MySqlConnection(str)))
                {
                    localConnection.Bind(state =>
                    {
                        Debug.WriteLine("{0}:{1}", state.CommandText, state.Parameter == null ? "" : state.Parameter.GetType().FullName);
                    });

                    var person = new Person() { Name = "TestInsertStrongClassInstanceName", Age = rand.Next(1, 100), Address = "TestInsertStrongClassInstanceAddress", Enabled = true };

                    var count = localConnection.Insert<Person>(person);
                    localConnection.Unbind();
                }
            });
        }