Custom Handler library compatibility

Source: Internet
Author: User

Original post address: http://devnet.kentico.com/Knowledge-Base/API-and-Internals/Custom-Handler-Library-compatibility.aspx

This article addresses differences between the old method of defining Custom Event Handlers using Custom Event Handler libraries, and the new method of using the app_code class and the extent of the backward compatibility.

Since kentico CMS V6, a new method of defining Custom Event Handlers has been introduced, a complete description can be found in the event
Handlers article.

The old method of using a Custom Event Handler library project has since been rendered obsolete but basic backwards compatibility has been preserved. the most noticeable difference is that some events may not trigger the handlers they used,
As they are no longer associated with them. For example, saving a document will no longer trigger methods in customdatahandler, but only those in the customtreenodehandler. This is due to a different event Association.

An old custom event handler is now called when a related new event handler has been triggered. for example onbeforeinsert in the customtreenodehandler will only trigger when extends entevents. insert. before event has been triggered. this table contains
A complete list of all event associations:


Library Handler App_code Handler
   
Customtreenodehandler. onbeforeinsert Documentevents. Insert. Before
Customtreenodehandler. onafterinsert Documentevents. insertfter
Customtreenodehandler. onbeforeinsert Documentevents. insertlink. Before
Customtreenodehandler. onafterinsert Incluentevents. insertlink. After
Customtreenodehandler. onbeforeinsertnewcultureversion Incluentevents. insertnewculture. Before
Customtreenodehandler. onafterinsertnewcultureversion Incluentevents. insertnewculture. After
Customtreenodehandler. onbeforeupdate Documentevents. Update. Before
Customtreenodehandler. onafterupdate Documentevents. Update. After
Customtreenodehandler. onbeforedelete Deleentevents. Delete. Before
Customtreenodehandler. onafterdelete Deleentevents. Delete. After
Customtreenodehandler. onbeforecopy Documentevents. Copy. Before
Customtreenodehandler. onaftercopy Documentevents. Copy. After
Customtreenodehandler. onbeforemove Incluentevents. Move. Before
Customtreenodehandler. onaftermove Incluentevents. Move. After
   
Customdatahandler. onbeforeinsert Objectevents. Insert. Before
Customdatahandler. onafterinsert Objectevents. Insert. After
Customdatahandler. onbeforeupdate Objectevents. Update. Before
Customdatahandler. onafterupdate Objectevents. Update. After
Customdatahandler. onbeforedelete Objectevents. Delete. Before
Customdatahandler. onbeforedelete Objectevents. Delete. After
Customdatahandler. onafterdelete Objectevents. getcontent. Execute
Customdatahandler. ongetcontent Documentevents. getcontent. Execute
   
Customsecurityhandler. onauthentication Securityevents. Authenticate. Execute
Customsecurityhandler. onclassnameauthorization Securityevents. authorizeclass. Execute
Customsecurityhandler. onresourceauthorization Securityevents. authorizeresource. Execute
Customsecurityhandler. onuielementauthorization Securityevents. authorizeuielement. Execute
Customsecurityhandler. onfilterdatasetbypermissions Documentevents. filterdatasetbypermissions. Execute
Customsecurityhandler. ontreenodeauthorization Documentevents. authorizedocument. Execute
   
Customexceptionhandler. onexception Systemevents. Exception. Execute
   
Customworkflowhandler. onbeforeapprove Workflowevents. Approve. Before
Customworkflowhandler. onafterapprove Workflowevents. Approve. After
Customworkflowhandler. onbeforecheckin Workflowevents. checkin. Before
Customworkflowhandler. onaftercheckin Workflowevents. checkin. After
Customworkflowhandler. onbeforecheckout Workflowevents. Checkout. Before
Customworkflowhandler. onaftercheckout Workflowevents. Checkout. After
Customworkflowhandler. onbeforepublish Workflowevents. Publish. Before
Customworkflowhandler. onafterpublish Workflowevents. Publish. After
Customworkflowhandler. onbeforereject Workflowevents. Reject. Before
Customworkflowhandler. onafterreject Workflowevents. Reject. After


It is not recommended to use the old custom handler libraries and try to re-implement them as custom global event handlers in app_code as soon as possible. the handler libraries are only supported for backwards compatibility and may be removed
Completely in future kentico versions.

In general, you shoshould encounter no problems moving your code from the Custom Handler Library to the app_code handler class, however there are some differences which need to be addressed by your code. the most significant change had been made
To the event arguments passed to the handler. in the event handler library, the arguments were anonymous objects which had to be typecast as idataclass in order to be used. the new handlers receive stronugly typed argument Either treenode E. node or baseinfo E. object with all data related to the object tied to the event. even though the typecasting of these properties is no longer necessary to access contained information, it is possible to typecast both of them as idatacontainer,
As an alternative to the idataclass. however this is not a recommended practice and shocould be avoided when possible. you can find more detailed description of which handler class accepts which eventargs class in the article linked above.
-JD-




See also: 
Event Handlers Overview
Obsolete event handlers
Data Handler
Exception handler
Security Handler
Treenode Handler
Workflow Handler

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.