Esempio n. 1
0
            public void OnEvent(object sender, Db4objects.Db4o.Events.CancellableObjectEventArgs
                                args)
            {
                object obj = ((CancellableObjectEventArgs)args).Object;

                Assert.IsFalse(obj is IObjectContainer);
            }
Esempio n. 2
0
			void registry_Updating(object sender, CancellableObjectEventArgs args)
			{
				ITimestampable timestampable = args.Object as ITimestampable;
				if (timestampable == null) return;

				timestampable.Updated = DateTime.Now;
			}
Esempio n. 3
0
 // #example: Validation support
 private static void ValidateObject(object sender,
                                    CancellableObjectEventArgs eventInfo)
 {
     ValidationContext context = new ValidationContext(eventInfo.Object, null, null);
     // This throws when the object isn't valid.
     Validator.ValidateObject(eventInfo.Object, context, true);
 }
        void registry_Creating(object sender, CancellableObjectEventArgs args)
        {
            object entity = args.Object;

            TypeGeneratorPair pair = generatorMap.Get(entity.GetType());
            if (pair != null)
                pair.SetId(entity,container);
        }
            public void OnEvent(object sender, Db4objects.Db4o.Events.CancellableObjectEventArgs
                                objectInfo)
            {
                IObjectContainer container = ((CancellableObjectEventArgs)objectInfo).ObjectContainer
                                                 ();

                // this crashes if the MetaInfoWithEnum-class is unknown!
                container.Query(typeof(QueryInCallBackCSCallback.MetaInfo));
            }
Esempio n. 6
0
            public void OnEvent(object sender, Db4objects.Db4o.Events.CancellableObjectEventArgs
                                args)
            {
                object obj = ((ObjectEventArgs)args).Object;

                if (obj is ActivationEventsTestCase.NonActivatableItem)
                {
                    ((ICancellableEventArgs)args).Cancel();
                }
            }
Esempio n. 7
0
 public void OnEvent(object sender, CancellableObjectEventArgs
     args)
 {
     var cancellable = args;
     if (cancellable.Object is Page)
     {
         var page = (Page) cancellable.Object;
         if (!page.IsDirty())
         {
             cancellable.Cancel();
         }
     }
 }
Esempio n. 8
0
            public void OnEvent(object sender, Db4objects.Db4o.Events.CancellableObjectEventArgs
                                args)
            {
                CancellableObjectEventArgs cancellable = (CancellableObjectEventArgs)args;

                if (cancellable.Object is Page)
                {
                    Page page = (Page)cancellable.Object;
                    if (!page.IsDirty())
                    {
                        cancellable.Cancel();
                    }
                }
            }
Esempio n. 9
0
 // #example: Referential integrity
 private static void ReferentialIntegrityCheck(object sender,
                                               CancellableObjectEventArgs eventArguments)
 {
     object toDelete = eventArguments.Object;
     if (toDelete is Pilot)
     {
         IObjectContainer container = eventArguments.ObjectContainer();
         IEnumerable<Car> cars = from Car c in container
                                 where c.Pilot == toDelete
                                 select c;
         if (cars.Count() > 0)
         {
             eventArguments.Cancel();
         }
     }
 }
            public void OnEvent(object sender, Db4objects.Db4o.Events.CancellableObjectEventArgs
                                args)
            {
                object obj = ((CancellableObjectEventArgs)args).Object;

                if (!(obj is UpdateInCallbackThrowsTestCase.Item))
                {
                    return;
                }
                Transaction transaction = (Transaction)((CancellableObjectEventArgs)args).Transaction
                                              ();
                IObjectContainer container = transaction.ObjectContainer();

                UpdateInCallbackThrowsTestCase.Item foo   = (UpdateInCallbackThrowsTestCase.Item)obj;
                UpdateInCallbackThrowsTestCase.Item child = foo._child;
                if (isNetworking)
                {
                    container.Activate(child, 1);
                }
                child._name += "*";
                container.Store(child);
            }
Esempio n. 11
0
 public void OnEvent(object sender, Db4objects.Db4o.Events.CancellableObjectEventArgs
                     args)
 {
     deletionLog.xing = true;
     this._enclosing.AssertItemIsActive(args);
 }
Esempio n. 12
0
			void OnCreating(object sender, CancellableObjectEventArgs args)
			{
				_events.Add("Creating");
				Assert.IsFalse(args.IsCancelled);
				args.Cancel();
			}
Esempio n. 13
0
			public void OnEvent(object sender, Db4objects.Db4o.Events.CancellableObjectEventArgs
				 args)
			{
				Assert.Expect(typeof(InvalidOperationException), new _ICodeBlock_18(executed, args
					));
			}
Esempio n. 14
0
 public void OnEvent(object sender, CancellableObjectEventArgs
     args)
 {
     ((ICancellableEventArgs) args).Cancel();
 }
Esempio n. 15
0
			public _IRunnable_258(System.EventHandler<CancellableObjectEventArgs> e, CancellableObjectEventArgs
				 args)
			{
				this.e = e;
				this.args = args;
			}
Esempio n. 16
0
 public void OnEvent(object sender, CancellableObjectEventArgs
     args)
 {
     var obj = args.Object;
     if (obj is NonActivatableItem)
     {
         ((ICancellableEventArgs) args).Cancel();
     }
 }
Esempio n. 17
0
		internal virtual bool TriggerCancellableObjectEventArgsInCallback(Transaction transaction
			, System.EventHandler<CancellableObjectEventArgs> e, IObjectInfo objectInfo, object
			 o)
		{
			if (!(e != null))
			{
				return true;
			}
			CancellableObjectEventArgs args = new CancellableObjectEventArgs(transaction, objectInfo
				, o);
			WithExceptionHandlingInCallback(new _IRunnable_258(e, args));
			return !args.IsCancelled;
		}
Esempio n. 18
0
 public void OnEvent(object sender, CancellableObjectEventArgs
     args)
 {
     deletionLog.xing = true;
     _enclosing.AssertItemIsActive(args);
 }
 public void OnEvent(object sender, CancellableObjectEventArgs
     args)
 {
     var obj = args.Object;
     if (!(obj is Item))
     {
         return;
     }
     var transaction = (Transaction) args.Transaction
         ();
     var container = transaction.ObjectContainer();
     var foo = (Item) obj;
     var child = foo._child;
     if (isNetworking)
     {
         container.Activate(child, 1);
     }
     child._name += "*";
     container.Store(child);
 }
Esempio n. 20
0
 public void OnEvent(object sender, CancellableObjectEventArgs
     args)
 {
     Assert.Expect(typeof (InvalidOperationException), new _ICodeBlock_18(executed, args
         ));
 }
 public void OnEvent(object sender, CancellableObjectEventArgs
     args)
 {
     var obj = args.Object;
     Assert.IsFalse(obj is IObjectContainer);
 }
 public void OnEvent(object sender, CancellableObjectEventArgs
     args)
 {
     called.value = true;
     foundTrans.value = args.Transaction();
 }
Esempio n. 23
0
		private void OnActivating(object sender, CancellableObjectEventArgs args)
		{
			if (_doNotActivateTypes.Contains(sender.GetType()))
			{
				args.Cancel();
			}
		}
Esempio n. 24
0
 public void OnEvent(object sender, CancellableObjectEventArgs
     args)
 {
     _enclosing.AssertClientTransaction(args);
     activationLog.xing = true;
 }
 public void OnEvent(object sender, Db4objects.Db4o.Events.CancellableObjectEventArgs
                     args)
 {
     called.value     = true;
     foundTrans.value = ((TransactionalEventArgs)args).Transaction();
 }
 public void OnEvent(object sender, Db4objects.Db4o.Events.CancellableObjectEventArgs
                     args)
 {
     this._enclosing.AssertClientTransaction(((CancellableObjectEventArgs)args));
     activationLog.xing = true;
 }
 public void OnEvent(object sender, Db4objects.Db4o.Events.CancellableObjectEventArgs
                     args)
 {
     throw new NotImplementedException();
 }
 public void OnEvent(object sender, CancellableObjectEventArgs
     args)
 {
     throw new Exception();
 }
Esempio n. 29
0
 public void OnEvent(object sender, Db4objects.Db4o.Events.CancellableObjectEventArgs
                     args)
 {
     ((ICancellableEventArgs)args).Cancel();
 }
Esempio n. 30
0
 public void OnEvent(object sender, CancellableObjectEventArgs
     args)
 {
 }