示例#1
0
 void IContentStorageFilter.Destroyed(DestroyContentContext context)
 {
     if (context.ContentItem.Is <TPart>())
     {
         Destroyed(context, context.ContentItem.As <TPart>());
     }
 }
示例#2
0
 protected override void Destroyed(DestroyContentContext context, TPart instance)
 {
     if (OnDestroyed != null)
     {
         OnDestroyed(context, instance);
     }
 }
示例#3
0
 void IContentHandler.Destroyed(DestroyContentContext context)
 {
     foreach (var filter in Filters.OfType <IContentStorageFilter>())
     {
         filter.Destroyed(context);
     }
     Destroyed(context);
 }
        protected override void Destroying(DestroyContentContext context, ContentPart <TRecord> instance)
        {
            // Get all content item version records.
            var allVersions = context.ContentItem.Record.Versions.ToArray();

            // For each version record, delete its part record (ID of versioned part records is the same as the ID of a version record).
            foreach (var versionRecord in allVersions)
            {
                var partRecord = _repository.Get(versionRecord.Id);

                if (partRecord != null)
                {
                    _repository.Delete(partRecord);
                }
            }
        }
示例#5
0
 protected virtual void Destroyed(DestroyContentContext context)
 {
 }
 public void Destroying(DestroyContentContext context)
 {
 }
 public void Destroyed(DestroyContentContext context)
 {
 }
示例#8
0
 protected virtual void Destroyed(DestroyContentContext context, TPart instance)
 {
 }
示例#9
0
 public virtual void Destroyed(DestroyContentContext context)
 {
 }
 protected override void Destroyed(DestroyContentContext context) {
     RecordAuditTrailEvent(ContentAuditTrailEventProvider.Destroyed, context.ContentItem);
 }
示例#11
0
        public void Destroy(ContentItem contentItem)
        {
            var session = _sessionLocator.Value.For(typeof(ContentItemRecord));
            var context = new DestroyContentContext(contentItem);

            // Give storage filters a chance to delete content part records.
            Handlers.Invoke(handler => handler.Destroying(context), Logger);

            // Delete the content item record itself.
            session
                .CreateQuery("delete from Orchard.ContentManagement.Records.ContentItemRecord ci where ci.Id = (:id)")
                .SetParameter("id", contentItem.Id)
                .ExecuteUpdate();

            Handlers.Invoke(handler => handler.Destroyed(context), Logger);
        }