protected override void PersistDeletedItem(ContentXmlEntity <TContent> entity) { //Remove 'published' xml from the cmsContentXml table for the unpublished content Database.Delete <ContentXmlDto>("WHERE nodeId = @Id", new { Id = entity.Id }); entity.DeletedDate = DateTime.Now; }
protected override void PersistNewItem(ContentXmlEntity <TContent> entity) { if (entity.Content.HasIdentity == false) { throw new InvalidOperationException("Cannot insert or update an xml entry for a content item that has no identity"); } var poco = new ContentXmlDto { NodeId = entity.Id, Xml = entity.Xml.ToDataString() }; //We need to do a special InsertOrUpdate here because we know that the ContentXmlDto table has a 1:1 relation // with the content table and a record may or may not exist so the // unique constraint which can be violated if 2+ threads try to execute the same insert sql at the same time. Database.InsertOrUpdate(poco); }
//NOTE: Not implemented because all ContentXmlEntity will always return false for having an Identity protected override void PersistUpdatedItem(ContentXmlEntity <TContent> entity) { throw new NotImplementedException(); }