Exemple #1
0
        public virtual void Test2()
		{
			if (!isLocal)
			{
				return;
			}
			NeoDatis.Odb.ODB odb = null;
			DeleteBase("trigger.neodatis");
			NeoDatis.Odb.Test.Trigger.MyTrigger myTrigger = new NeoDatis.Odb.Test.Trigger.MyTrigger
				();
			try
			{
				odb = Open("trigger.neodatis");
				odb.AddInsertTrigger(typeof(Function), myTrigger);
				Function f1 = new Function(
					"function1");
				Function f2 = new Function(
					"function2");
				Profile profile = new Profile
					("profile1", f1);
				User user = new User("oli", 
					"*****@*****.**", profile);
				odb.Store(user);
				odb.Store(f2);
			}
			finally
			{
				if (odb != null)
				{
					odb.Close();
				}
			}
			odb = Open("trigger.neodatis");
			odb.Close();
			DeleteBase("trigger.neodatis");
			AssertEquals(2, myTrigger.nbInsertsBefore);
			AssertEquals(2, myTrigger.nbInsertsAfter);
		}
Exemple #2
0
 // To test if triggers are called on recursive objects
 /// <exception cref="System.Exception"></exception>
 public virtual void Test2()
 {
     if (!isLocal)
     {
         return;
     }
     NeoDatis.Odb.ODB odb = null;
     DeleteBase("trigger.neodatis");
     NeoDatis.Odb.Test.Trigger.MyTrigger myTrigger = new NeoDatis.Odb.Test.Trigger.MyTrigger
                                                         ();
     try
     {
         odb = Open("trigger.neodatis");
         odb.AddInsertTrigger(typeof(Function), myTrigger);
         Function f1 = new Function(
             "function1");
         Function f2 = new Function(
             "function2");
         Profile profile = new Profile
                               ("profile1", f1);
         User user = new User("oli",
                              "*****@*****.**", profile);
         odb.Store(user);
         odb.Store(f2);
     }
     finally
     {
         if (odb != null)
         {
             odb.Close();
         }
     }
     odb = Open("trigger.neodatis");
     odb.Close();
     DeleteBase("trigger.neodatis");
     AssertEquals(2, myTrigger.nbInsertsBefore);
     AssertEquals(2, myTrigger.nbInsertsAfter);
 }