1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / IContentLifecycleManager vs ILifecycleManager

IContentLifecycleManager vs ILifecycleManager

6 posts, 0 answered
  1. Victor
    Victor avatar
    94 posts
    Registered:
    15 Jun 2011
    18 Jan 2013
    Link to this post

    Not really sure how to start.  

    I have a custom module with two content types (two data models) both implementing Lifecycle.

    I am trying to use one manager to handle both content types.  I can implement IContentLifecycleManager  for both types in one manager and it the manager to handle check in/check out of each content type separately. But...

    IContentLifecycleManager  is deprecated.  And we are supposed to use the LifecycleDecorator right?  But how can only one LifecycleDecorator  be used for two different content types??  In the example below a content type needs to be supplied:

    public ILifecycleDecorator Lifecycle
        {
            get
            {
                return LifecycleFactory.CreateLifecycle<ContentType#1>(this, new Action<Content, Content>(this.Copy));
            }
        }

    So how do you supply two decorators?





  2. Stefani Tacheva
    Stefani Tacheva avatar
    718 posts
    Registered:
    31 May 2017
    22 Jan 2013
    Link to this post
    Hello Victor,

    If you want to have artificial relation between two content types (for example when you create Type1 item you need to automatically create Type 2 item and when you delete one - to delete the other automatically) you may write a custom decorator that inherits the LifecycleDecorator for the creation and handle Provider_Executing event of DynamicModuleManager on ApplicationStart for the deletion. On the other hand from 5.1 we had hierarchical types which support cascade delete (when you delete the parent the child is deleted as well).

    Furthermore, the following KB article might be useful.

    Kind regards,
    Stefani Tacheva
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. Denis
    Denis avatar
    105 posts
    Registered:
    27 Feb 2009
    26 Jan 2013 in reply to Victor
    Link to this post

    Just curious, in what situations you need to create custom module with two content types?
    In your custom module project you have 2 view-models, 2 services, 2 definitions, right?

  4. Victor
    Victor avatar
    94 posts
    Registered:
    15 Jun 2011
    28 Jan 2013 in reply to Denis
    Link to this post
    One example would be a gym.  They might have multiple locations (one content type), each location might offer different classes (another content type), each class might be taught by different instructors (again, another content type).

    There are also a number of relationships involved.  It gets pretty complicated having multiple view models, multiple services (which sometimes overlap due to the relationships).

    So up to now its been easier to create all the content types using module builder and then manually customizing all the config files and custom fields, but this approach makes installing the same module on different sites a bit of a challenge, so I was looking for something to make the installation a little easier, so I thought I'd package the whole thing into a custom module.
  5. Denis
    Denis avatar
    105 posts
    Registered:
    27 Feb 2009
    30 Jan 2013 in reply to Victor
    Link to this post
    Good thinking. As far as I understand, in first message you tried to understand if it is possible to do in module that built manually (like Products from SDK). And as workaround, so far, you are using Module Builder with manual configuration adjustments. Right?

    BTW did you ever play with custom membership providers? Would you mind to send me your email here info@webbywell.com? So we could have additional way to communicate besides this Forum. Good advice will save TONS of time, especially when the documentation is so-so :).  Thanks! Denis.
  6. Victor
    Victor avatar
    94 posts
    Registered:
    15 Jun 2011
    30 Jan 2013 in reply to Denis
    Link to this post

    Denis, I sent you an email with my contact info.

6 posts, 0 answered