Beispiel #1
0
        internal async Task Save(IPersister persister, string target)
        {
            persister.Access(target);
            await persister.Save(this);

            persister.Dispose();
        }
 public void Dispose()
 {
     _jobPersister?.Dispose();
     _errorPersister?.Dispose();
     _extractJobDetailsPersister?.Dispose();
     _subscriptionJobDetailsPersister?.Dispose();
 }
Beispiel #3
0
        protected void DoWork(Action action)
        {
            if (handleErrors)
            {
                action = WrapActionInErrorHandling(action);
            }

            if (async)
            {
                worker.DoWork(() =>
                {
                    Interlocked.Increment(ref workerCount);
                    try
                    {
                        action();
                        persister.Dispose();
                    }
                    finally
                    {
                        Interlocked.Decrement(ref workerCount);
                        currentWork = "";
                    }
                });
            }
            else
            {
                action();
            }
        }
Beispiel #4
0
 protected virtual void Dispose(bool disposing)
 {
     if (disposing)
     {
         if (persister != null)
         {
             persister.Dispose();
         }
     }
 }
        protected override void Dispose(bool disposing)
        {
            if (!disposed)
            {
                if (disposing)
                {
                    persister.Dispose();
                }

                disposed = true;
                base.Dispose(disposing);
            }
        }
Beispiel #6
0
        public void ReferencedItem_IsRenamed_AndDetailIsRemoved()
        {
            var part = CreateOneItem <NormalItem>(0, "part", page);

            persister.Save(part);

            Details.ContentDetail.New("EditableItem", part).AddTo(page);
            persister.Save(page);

            persister.Dispose();

            var result = worker.Migrate(new Edit.Installation.DatabaseStatus());

            result.UpdatedItems.ShouldBe(1);

            persister.Dispose();

            part = persister.Get <NormalItem>(part.ID);
            part.Name.ShouldBe("EditableItem");
            page = persister.Get <NormalPage>(page.ID);
            page.Details["EditableItem"].ShouldBe(null);
            page.EditableItem.ShouldBe(part);
        }
        public void AutoImplementedProperties_AreMaintained()
        {
            var master = CreateOneItem <NormalPage>(0, "master", null);

            master.WidthType = WidthType.Pixels;
            master.Width     = 123;
            persister.Save(master);

            var manager = new VersionManager(repository, persister.Repository, new StateChanger(), new N2.Configuration.EditSection());
            var version = (NormalPage)manager.AddVersion(master, asPreviousVersion: false);

            persister.Dispose();

            master  = (NormalPage)persister.Get(master.ID);
            version = (NormalPage)manager.GetVersion(master, version.VersionIndex);

            version.WidthType.ShouldBe(WidthType.Pixels);
            version.Width.ShouldBe(123);
        }
        public override void SetUp()
        {
            base.SetUp();

            persister = engine.Persister;
            versions  = engine.Resolve <IVersionManager>();

            persister.Dispose();

            CreateDatabaseSchema();

            root  = CreateOneItem <ThrowableItem>(0, "root", null);
            item  = CreateOneItem <ThrowableItem>(0, "item", root);
            item2 = CreateOneItem <ThrowableItem>(0, "item2", root);

            trash = engine.Resolve <ITrashHandler>();

            System.Threading.Thread.CurrentPrincipal = new GenericPrincipal(new GenericIdentity("admin", "test"), new string[] { "Administrators" });
        }
Beispiel #9
0
 public void Dispose()
 {
     if (sessionPersister != null)
     {
         sessionPersister.Dispose();
     }
     if (errorPersister != null)
     {
         errorPersister.Dispose();
     }
     if (performanceEventPersister != null)
     {
         performanceEventPersister.Dispose();
     }
     if (endQueryPersister != null)
     {
         endQueryPersister.Dispose();
     }
 }
        public void Trash_CanBePurged()
        {
            trash.Throw(item);
            trash.PurgeAll();
            persister.Dispose();

            engine.Persister.Get(item.ID).ShouldBe(null);
        }
 public void Dispose()
 {
     _sessionPersister?.Dispose();
     _errorPersister?.Dispose();
 }
Beispiel #12
0
 public override void TearDown()
 {
     persister.Dispose();
     base.TearDown();
 }