/// <exception cref="System.Exception"></exception>
        public virtual void Test()
        {
            BooleanByRef disconnected = new BooleanByRef();
            Lock4        Lock         = new Lock4();

            if (IsNetworking())
            {
                IDb4oClientServerFixture clientServerFixture = (IDb4oClientServerFixture)Fixture(
                    );
                IObjectServerEvents objectServerEvents = (IObjectServerEvents)clientServerFixture
                                                         .Server();
                objectServerEvents.ClientDisconnected += new System.EventHandler <Db4objects.Db4o.Events.StringEventArgs>
                                                             (new _IEventListener4_46(Lock, disconnected).OnEvent);
            }
            DeleteOnDeletingCallbackTestCase.RootItem root = ((DeleteOnDeletingCallbackTestCase.RootItem
                                                               )RetrieveOnlyInstance(typeof(DeleteOnDeletingCallbackTestCase.RootItem)));
            root.child = new DeleteOnDeletingCallbackTestCase.Item();
            Db().Store(root);
            Db().Delete(root);
            Reopen();
            if (IsNetworking())
            {
                Lock.Run(new _IClosure4_63(disconnected, Lock));
            }
            AssertClassIndexIsEmpty();
        }
Example #2
0
        private void RegisterEventHandlers()
        {
            IObjectContainer deletionEventSource = Db();

            if (Fixture() is IDb4oClientServerFixture)
            {
                IDb4oClientServerFixture clientServerFixture = (IDb4oClientServerFixture)Fixture(
                    );
                deletionEventSource = clientServerFixture.Server().Ext().ObjectContainer();
            }
            IEventRegistry eventRegistry         = EventRegistryFactory.ForObjectContainer(Db());
            IEventRegistry deletionEventRegistry = EventRegistryFactory.ForObjectContainer(deletionEventSource
                                                                                           );

            // No dedicated IncrementListener class due to sharpen event semantics
            deletionEventRegistry.Deleted += new System.EventHandler <Db4objects.Db4o.Events.ObjectInfoEventArgs>
                                                 (new _IEventListener4_91(this).OnEvent);
            eventRegistry.Activated += new System.EventHandler <Db4objects.Db4o.Events.ObjectInfoEventArgs>
                                           (new _IEventListener4_96(this).OnEvent);
            eventRegistry.Committed += new System.EventHandler <Db4objects.Db4o.Events.CommitEventArgs>
                                           (new _IEventListener4_101(this).OnEvent);
            eventRegistry.Created += new System.EventHandler <Db4objects.Db4o.Events.ObjectInfoEventArgs>
                                         (new _IEventListener4_106(this).OnEvent);
            eventRegistry.Updated += new System.EventHandler <Db4objects.Db4o.Events.ObjectInfoEventArgs>
                                         (new _IEventListener4_111(this).OnEvent);
        }