Home

Castle Stronghold

Table of contents

Startable Facility

The Startable Facility adds and manage the startable behavior of a component.

Facility Summary
Uses ProxyNo
Requires configurationNo
Uses attributeNo
VersionBeta 3
Maturity levelHigh

Introduction

By using this facility, the container can start/stop components that implement the IStartable interface or has an startable attribute set to true.

Quick start

Register the facility and then register components that implement the IStartable interface.


<facility id="startable"
    type="Castle.Facilities.Startable.StartableFacility, Castle.MicroKernel" / >
    

You can mark components as startable without using the IStartable interface. This will make the facility request the component, thus creating an instance, when the component is ready. In order to do so, use the startable attribute on the component configuration.


<component id="mycomponent"
    type="Namespace.MyComponent, Assembly"
    startable="true" / >
    

You can optionally specify a method to be invoked to start the component and other when the container needs to stop it:


<component id="mycomponent"
    type="Namespace.MyComponent, Assembly"
    startable="true" startMethod="StartListener" stopMethod="StopListener" / >
    

The methods must be public and parameterless.

What does it mean to be "Startable"?

Any component that has a start and stop semantic is a candidate to be startable. More examples:

Required Assemblies

The facility is included in the Castle.MicroKernel assembly

Google
Search WWW Search castleproject.org