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

前端 未结 1 1037
情深已故
情深已故 2020-12-16 09:17

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

相关标签:
1条回答
  • 2020-12-16 09:32

    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.

    0 讨论(0)
提交回复
热议问题