Beispiel #1
0
        public static void ASYNC_InsertInTransaction_Commit_TypedRow(ICRUDDataStore store)
        {
            var transaction = store.BeginTransactionAsync().Result;

            var tasks = new List<Task>();
            for(var i=0; i<25; i++)
            {
                tasks.Add(
                  transaction.InsertAsync( new Patient
                                 {
                                   SSN = "999-88-9012",
                                   First_Name = "Jack",
                                   Last_Name = "Kozloff"+i,
                                   DOB = new DateTime(1980, 1, 12)
                                 }));
            }

            Task.WaitAll(tasks.ToArray());

            var task = store.LoadAsync( new Query("CRUD.Patient.List", typeof(Patient) ) { new Query.Param("LN", "%loff%") } );

            Assert.AreEqual(0, task.Result[0].Count);

            transaction.Commit();

            task = store.LoadAsync( new Query("CRUD.Patient.List", typeof(Patient) ) { new Query.Param("LN", "%loff%") } );

            Assert.AreEqual(25, task.Result[0].Count);
        }
Beispiel #2
0
        public static void ASYNC_InsertInTransaction_Commit_TypedRow(ICRUDDataStore store)
        {
            var transaction = store.BeginTransactionAsync().Result;

            var tasks = new List <Task>();

            for (var i = 0; i < 25; i++)
            {
                tasks.Add(
                    transaction.InsertAsync(new Patient
                {
                    SSN        = "999-88-9012",
                    First_Name = "Jack",
                    Last_Name  = "Kozloff" + i,
                    DOB        = new DateTime(1980, 1, 12)
                }));
            }

            Task.WaitAll(tasks.ToArray());


            var task = store.LoadAsync(new Query("CRUD.Patient.List", typeof(Patient))
            {
                new Query.Param("LN", "%loff%")
            });

            Assert.AreEqual(0, task.Result[0].Count);

            transaction.Commit();

            task = store.LoadAsync(new Query("CRUD.Patient.List", typeof(Patient))
            {
                new Query.Param("LN", "%loff%")
            });

            Assert.AreEqual(25, task.Result[0].Count);
        }