Beispiel #1
0
        public void TestInsertMultiplePostgreSql()
        {
            Third third = new Third();

            third.ThirdStuff = "lalala";

            Second s = new Second();

            s.Age      = 456;
            s.Quantity = 43;

            s.AttachTableMetadata(third);

            First first = new First();

            first.Name = "Gogu";

            first.AttachTableMetadata(s);

            List <ExecutionQuery> list = SqlGenerator.GenerateMultipleInsertQueries(DatabaseServer.PostgreSql, first);

            foreach (ExecutionQuery var in list)
            {
                Console.WriteLine(var.Query);
            }

            Assert.IsTrue(list.Count > 0);
        }
Beispiel #2
0
        public void TestCreateMultiple()
        {
            Third third = new Third();

            third.ThirdStuff = "lalala";

            Second s = new Second();

            s.Age      = 456;
            s.Quantity = 43;

            s.AttachTableMetadata(third);

            First first = new First();

            first.Name = "Gogu";

            first.AttachTableMetadata(s);

            firstPersistent.Create(first);
        }
Beispiel #3
0
        public void ExecuteMultipleOperationsInTransaction()
        {
            Session s = Session.CreateNewSession(DatabaseServer.SqlServer, SharedData.sqlserver);

            CategoryTableMetadata    ctm        = new CategoryTableMetadata();
            CategoryPersistentObject persistent = new CategoryPersistentObject(s, ctm);

            First first = new First();
            FirstPersistentObject fp = new FirstPersistentObject(s, first);

            Third third = new Third();

            third.ThirdStuff = "lalala";

            Second sp = new Second();

            sp.Age      = 456;
            sp.Quantity = 43;

            sp.AttachTableMetadata(third);


            first.Name = "Crocodilu";

            first.AttachTableMetadata(sp);



            s.BeginTransaction();

            QueryCriteria qc = new QueryCriteria(ctm.TableName, ctm.TableFields[0]);

            qc.Add(CriteriaOperator.Max, ctm.TableFields[0]);

            //get the last one
            CategoryTableMetadata[] ct = (CategoryTableMetadata[])persistent.GetTableMetadata(qc);
            persistent.Delete(ct[0]);



            CategoryTableMetadata cc = new CategoryTableMetadata();

            cc.CategoryName = "fluffy";
            cc.Description  = "tingling";

            persistent.Create(cc);

            fp.Create(first);


            List <ExecutionQuery> scc = s.Queries;


            for (int i = 0; i < scc.Count; i++)
            {
                Console.WriteLine(scc[i]);
            }


            s.Commit();
        }