Bootstrapper question
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!
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.