Bootstrapper question

Posted by Community Admin on 04-Aug-2018 12:00

Bootstrapper question

All Replies

Posted by Community Admin on 22-Oct-2011 00:00

Hey guys!
Just noticed that the bootstrapper raises the Initialized Event twice (at least in my case) I saw few examples where this event is used as if it will rise just once. So I was wondering if I am doing something wrong?
The code is fairly simple:

protected void Application_Start(object sender, EventArgs e)
    Bootstrapper.Initialized += new EventHandler<ExecutedEventArgs>(OnSitefinityAppInitialized);

Then in the Initialized event handler we have some other work:

private void OnSitefinityAppInitialized(object sender, Telerik.Sitefinity.Data.ExecutedEventArgs args)
 

I noticed that if I check the args.CommandName, the first time it is rised it is set to "RegisterRoutes" and the next time it is "Bootstrapped", I used a simple if to check if the event is rised for "Bootstrapped" so my code works, I was just wondering if it is a good practice to check if the command name is "Bootstrapped".

Thanks in advance!

Posted by Community Admin on 26-Oct-2011 00:00

Hello Pavel,

Thank you for contacting us.

 You are correct that the Event is fired twice. Indeed, it is a good practice to check the command inside the handler, so that you can prevent your code from being executed twice.

Let me know if I can help you with something else.

All the best,
Svetoslav Petsov
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

This thread is closed