Events Handler outside AppCode

Nuno Silva asked on October 6, 2015 10:34

Hi all,

I'm using portal engine + aspx (8.2) and got a solution with several projects outside the main code provided by Kentico. I'm them using publish profiles to publish my solution into Kentico one but it seems that this way I'm not being able to handle events. Is there any way to handle events, for instance, SearchCrawler.HtmlToPlainTextHandler, outside the App_Code / Old_AppCode from Kentico solution?

I've got the following markup:

[DocumentCrawlerContentLoader]
public partial class CMSModuleLoader
{
    /// <summary>
    /// Attribute class for assigning event handlers.
    /// </summary>
    private class DocumentCrawlerContentLoaderAttribute : CMSLoaderAttribute
    {
        /// <summary>
        /// Called automatically when the application starts.
        /// </summary>
        public override void Init()
        {
            // Assigns a handler for the OnHtmlToPlainText event
            SearchCrawler.OnHtmlToPlainText += new SearchCrawler.HtmlToPlainTextHandler(SearchHelper_OnHtmlToPlainText);
        }
        .....

Hope this question makes sense.

Thanks

Correct Answer

Brenden Kehren answered on October 6, 2015 14:28

Any particular reason you wouldn't use App_Code or App_OldCode? If you don't, you have to reference all the Kentico DLLs in order to make anything build, then you have to add that DLL to your Kentico solution.

Is it possible to try things the other way around and have your needed code in Kentico to publish in the event handler but it is triggered by an outside source (library, web service, etc)

0 votesVote for this answer Unmark Correct answer

Recent Answers


Nuno Silva answered on October 6, 2015 17:31

Not for a particular reason, just to separate the project code from Kentico OTB one having a more lightweight build. Everything is working fine aside from events. I'll stick to the App_Code folder.

Thanks for quick reply and clarificaiton.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.