예제 #1
0
		// fails when the trigger is called after the object introspection (1.9
		// beta2)
		/// <exception cref="System.Exception"></exception>
		public virtual void Test1()
		{
			if (!isLocal && !testNewFeature)
			{
				return;
			}
			NeoDatis.Odb.ODB odb = null;
			string baseName = GetBaseName();
			DeleteBase(baseName);
			NeoDatis.Odb.Test.Trigger.MyTriggerBefore myTrigger = new NeoDatis.Odb.Test.Trigger.MyTriggerBefore
				();
			try
			{
				odb = Open(baseName);
				odb.AddInsertTrigger(typeof(NeoDatis.Odb.Test.Trigger.SimpleObject), myTrigger);
				NeoDatis.Odb.Test.Trigger.SimpleObject so = new NeoDatis.Odb.Test.Trigger.SimpleObject
					(5);
				NeoDatis.Odb.OID oid = odb.Store(so);
				AssertEquals(6, so.GetId());
				odb.Close();
				odb = Open(baseName);
				NeoDatis.Odb.Test.Trigger.SimpleObject so2 = (NeoDatis.Odb.Test.Trigger.SimpleObject
					)odb.GetObjectFromId(oid);
				AssertEquals(6, so2.GetId());
			}
			finally
			{
				if (odb != null)
				{
					odb.Close();
				}
			}
			DeleteBase(baseName);
		}
예제 #2
0
        public virtual void Test1()
        {
            if (!isLocal && !testNewFeature)
            {
                return;
            }
            NeoDatis.Odb.ODB odb      = null;
            string           baseName = GetBaseName();

            DeleteBase(baseName);
            NeoDatis.Odb.Test.Trigger.MyTriggerBefore myTrigger = new NeoDatis.Odb.Test.Trigger.MyTriggerBefore
                                                                      ();
            try
            {
                odb = Open(baseName);
                odb.AddInsertTrigger(typeof(NeoDatis.Odb.Test.Trigger.SimpleObject), myTrigger);
                NeoDatis.Odb.Test.Trigger.SimpleObject so = new NeoDatis.Odb.Test.Trigger.SimpleObject
                                                                (5);
                NeoDatis.Odb.OID oid = odb.Store(so);
                AssertEquals(6, so.GetId());
                odb.Close();
                odb = Open(baseName);
                NeoDatis.Odb.Test.Trigger.SimpleObject so2 = (NeoDatis.Odb.Test.Trigger.SimpleObject
                                                              )odb.GetObjectFromId(oid);
                AssertEquals(6, so2.GetId());
            }
            finally
            {
                if (odb != null)
                {
                    odb.Close();
                }
            }
            DeleteBase(baseName);
        }
예제 #3
0
 public virtual bool BeforeInsert(object @object)
 {
     NeoDatis.Odb.Test.Trigger.SimpleObject so = (NeoDatis.Odb.Test.Trigger.SimpleObject
                                                  )@object;
     // just add 1
     so.SetId(so.GetId() + 1);
     return(true);
 }
예제 #4
0
 // TODO Auto-generated method stub
 public override bool BeforeUpdate(NeoDatis.Odb.ObjectRepresentation oldObjectRepresentation
                                   , object newObject, NeoDatis.Odb.OID oid)
 {
     NeoDatis.Odb.Test.Trigger.SimpleObject so = (NeoDatis.Odb.Test.Trigger.SimpleObject
                                                  )newObject;
     // just add 1
     so.SetId(so.GetId() + 1);
     return(true);
 }