Ejemplo n.º 1
0
 protected override void Created(CreateContentContext context, TPart instance)
 {
     if (OnCreated != null)
     {
         OnCreated(context, instance);
     }
 }
Ejemplo n.º 2
0
 void IContentHandler.Created(CreateContentContext context)
 {
     foreach (var filter in Filters.OfType <IContentStorageFilter>())
     {
         filter.Created(context);
     }
     Created(context);
 }
Ejemplo n.º 3
0
        public virtual void Create(ContentItem contentItem, VersionOptions options)
        {
            if (contentItem.VersionRecord == null) {
                // produce root record to determine the model id
                contentItem.VersionRecord = new ContentItemVersionRecord {
                    ContentItemRecord = new ContentItemRecord(),
                    Number = 1,
                    Latest = true,
                    Published = true
                };
            }

            // add to the collection manually for the created case
            contentItem.VersionRecord.ContentItemRecord.Versions.Add(contentItem.VersionRecord);
            contentItem.VersionRecord.ContentItemRecord.ContentType = AcquireContentTypeRecord(contentItem.ContentType);

            // version may be specified
            if (options.VersionNumber != 0) {
                contentItem.VersionRecord.Number = options.VersionNumber;
            }

            // draft flag on create is required for explicitly-published content items
            if (options.IsDraft) {
                contentItem.VersionRecord.Published = false;
            }

            _contentItemStore.Store(contentItem);

            // build a context with the initialized instance to create
            var context = new CreateContentContext(contentItem);

            // invoke handlers to add information to persistent stores
            Handlers.Invoke(handler => handler.Creating(context));

            Handlers.Invoke(handler => handler.Created(context));

            if (options.IsPublished) {
                var publishContext = new PublishContentContext(contentItem, null);

                // invoke handlers to acquire state, or at least establish lazy loading callbacks
                Handlers.Invoke(handler => handler.Publishing(publishContext));

                // invoke handlers to acquire state, or at least establish lazy loading callbacks
                Handlers.Invoke(handler => handler.Published(publishContext));
            }
        }
Ejemplo n.º 4
0
 protected virtual void Created(CreateContentContext context)
 {
 }