Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
120 views
in Technique[技术] by (71.8m points)

orchardcms - What are the definitions of each of the Lifecycle Events in Orchard's CMS?

The documentation for content handlers in Orchard mentions Lifecycle Events (http://docs.orchardproject.net/Documentation/Understanding-content-handlers).

Most events are self explanatory, but I was wondering if anybody can tell me the differences between OnActivated, OnInitializing, and OnLoading?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

In firing order:

  • OnActivated - content item object hierarchy has been created, but not yet fetched from db

    Used for preparing content part for further usage. Eg. setting getters and setters for lazy loaded objects, setting up delegates etc. Think of it as of a "constructor" for a given part.

  • OnInitializing - content item object hierarchy has been created, but not yet fetched from db.

    Used for setting initial/default property values for a given part.

  • OnLoading - content item is about to be loaded from db.

    Used for various things. Fired only if an item exists in the database and is about to be loaded. Orchard core uses this event to set up lazy loaders for part records.

  • OnLoaded - content item has been loaded from db

    Used for various things. Fired only if an item exists in the database and all record loaders have been set. You can be sure that part.Record will not be null for any part at this point and will contain data fetched from database.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...