Start-up code using WebActivator in MVC application

Read full post on Falafel blog

WebActivator allows us to execute a code long before application start-up. There may be requirements when you need to load external assemblies or instantiate a particular object before the application start up. You need to make sure some codes execute before the codes inside the App_Start folder and the global.asax file. To do this WebActivator should be used.
You can add the WebActivator package using NuGet.

Let us consider an example in an MVC application in which we want to call a method of a class before  the execution of the application. To do this follow the steps below:

  • Attribute the class with WebActivator
  • Pass the type of the class
  • Pass the name of the method to be executed

Read full post on Falafel blog


Discover more from Dhananjay Kumar

Subscribe to get the latest posts sent to your email.

Published by Dhananjay Kumar

Dhananjay Kumar is founder of NomadCoder and ng-India

One thought on “Start-up code using WebActivator in MVC application

Leave a comment

Discover more from Dhananjay Kumar

Subscribe now to keep reading and get access to the full archive.

Continue reading