Developer forum

Forum » Development » Run module code at application startup?

Run module code at application startup?

Mats Lycken
Reply
Hi,
is it possible to create a module that has some code that runs automatically at application startup?
Is there some interface that I can implement or something like that to get code to run automatically?

Otherwise I'm thinking about inheriting Dynamicweb.Admin.Global and create my own startup functionality there, anything special I should think about? I.e. would I break something? I would naturally call base.OnXXX() in each override.

This would also be a feature suggestion, using special decorating interfaces for hooks. Or maybe MEF.

All answers and suggestions are greatly appreciated. :-)

BR,
Mats

Replies

 
Remi Muller
Reply
This post has been marked as an answer
 Create the following notification subscriber:

[Subscribe(Dynamicweb.Notifications.Standard.Application.Start)]
    public class AppStart : NotificationSubscriber
    {
        public override void OnNotify(string notification, NotificationArgs args)
        {
            base.OnNotify(notification, args);
            //implement some app start logic here
        }
    }
Votes for this answer: 0
 
Mats Lycken
Reply
Great!
That was exactly what I was looking for.

Thanks!

 

You must be logged in to post in the forum