Skip to content

ninject/Ninject.Extensions.Azure

Repository files navigation

Ninject.Extensions.Azure NuGet Version NuGet Downloads

This extension adds support for Microsoft Azure Worker Roles.

Getting started

Just derive from NinjectRoleEntryPoint in your WorkerRole.cs (previously RoleEntryPoint) and override the following methods:

The Run method is the main thread of execution for your role instance.

public abstract override void Run();

Implement the CreateKernel method to create and configure your kernel and load the modules required by your role instance.

protected abstract IKernel CreateKernel();

If you like to extend the startup behavior of your role instance just override OnRoleStarted() which is called after CreateKernel.

protected virtual bool OnRoleStarted();

If you like to extend the shutdown behavior of your role instance you have two choices. You can override OnRoleStopping() which is called before the kernel is disposed.

protected virtual void OnRoleStopping();

Addition to that you can also override OnRoleStopped() which is called after the kernel is disposed.

protected virtual void OnRoleStopped();

CI build status

Build Status