Posted on 10/08/2018 10:32:08
Hi Martin,
The exceptions are:
1-
Dynamicweb.SystemTools.RecycleBin.RecycleBinException: Primary item must have a value before committing
at Dynamicweb.SystemTools.RecycleBin.RecycleBin.Commit()
at Dynamicweb.SystemTools.RecycleBin.RecycleBin.Dispose(Boolean disposing)
at Dynamicweb.SystemTools.RecycleBin.RecycleBin.Dispose()
at Dynamicweb.Content.PageService.MoveToBin(Page obj)
at Dynamicweb.Content.PageService.DeletePage(Int32 pageId)
at CompiledRazorTemplates.Dynamic.fcddebdaabfbbfd.Execute()
at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context)
at RazorEngine.Templating.TemplateService.Run(ITemplate template, DynamicViewBag viewBag)
at RazorEngine.Templating.TemplateService.Parse(String razorTemplate, Object model, DynamicViewBag viewBag, String cacheName)
at RazorEngine.Razor.Parse[T](String razorTemplate, T model, String cacheName)
at Dynamicweb.Rendering.Template.RenderRazorTemplate()
2-
Dynamicweb.SystemTools.RecycleBin.RecycleBinException: Primary item must have a value before committing
at Dynamicweb.SystemTools.RecycleBin.RecycleBin.Commit()
at Dynamicweb.SystemTools.RecycleBin.RecycleBin.Dispose(Boolean disposing)
at Dynamicweb.SystemTools.RecycleBin.RecycleBin.Dispose()
at Dynamicweb.Content.PageService.MoveToBin(Page obj)
at CompiledRazorTemplates.Dynamic.bcdceaebe.Execute()
at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context)
at RazorEngine.Templating.TemplateService.Run(ITemplate template, DynamicViewBag viewBag)
at RazorEngine.Templating.TemplateService.Parse(String razorTemplate, Object model, DynamicViewBag viewBag, String cacheName)
at RazorEngine.Razor.Parse[T](String razorTemplate, T model, String cacheName)
at Dynamicweb.Rendering.Template.RenderRazorTemplate()
3-
Dynamicweb.SystemTools.RecycleBin.RecycleBinException: Primary item must have a value before committing
at Dynamicweb.SystemTools.RecycleBin.RecycleBin.Commit()
at Dynamicweb.SystemTools.RecycleBin.RecycleBin.Dispose(Boolean disposing)
at Dynamicweb.SystemTools.RecycleBin.RecycleBin.Dispose()
at CompiledRazorTemplates.Dynamic.afcddec.Execute()
at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context)
at RazorEngine.Templating.TemplateService.Run(ITemplate template, DynamicViewBag viewBag)
at RazorEngine.Templating.TemplateService.Parse(String razorTemplate, Object model, DynamicViewBag viewBag, String cacheName)
at RazorEngine.Razor.Parse[T](String razorTemplate, T model, String cacheName)
at Dynamicweb.Rendering.Template.RenderRazorTemplate()
And I've tried a new version also:
4-
var pageService = new PageService();
var page = pageService.GetPage(331);
using (var bin = new Dynamicweb.SystemTools.RecycleBin.RecycleBin())
{
var binIt = new Dynamicweb.SystemTools.RecycleBin.RecycleItem();
binIt.Data = "www";
binIt.AssemblyQualifiedName = page.GetType().ToString();
binIt.DeletedAt = DateTime.Now;
binIt.DeletedBy = "rui";
binIt.Description = "hkxdbkjbdkjd";
binIt.IsPrimary = true;
binIt.ObjectID = page.ID.ToString();
bin.AddItem(binIt);
pageService.MoveToExistingBin(page, bin.UnitID);
}
That returns the exception:
System.NullReferenceException: Object reference not set to an instance of an object.
at Dynamicweb.Content.PageService.CreateRecycleItem(Page page)
at Dynamicweb.Content.PageService.MoveToBin(Page page, RecycleBin bin)
at Dynamicweb.Content.PageService.MoveToExistingBin(Page obj, Guid unitId)
at CompiledRazorTemplates.Dynamic.bcdcaaeacbf.Execute()
at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context)
at RazorEngine.Templating.TemplateService.Run(ITemplate template, DynamicViewBag viewBag)
at RazorEngine.Templating.TemplateService.Parse(String razorTemplate, Object model, DynamicViewBag viewBag, String cacheName)
at RazorEngine.Razor.Parse[T](String razorTemplate, T model, String cacheName)
at Dynamicweb.Rendering.Template.RenderRazorTemplate()