Home

Castle Stronghold

Batch Registration Facility

The Batch Registration Facility registers components based on configuration instructions.

Facility Summary
Uses ProxyNo
Requires configurationYes
Uses attributeOptionally
VersionBeta 2
Maturity levelLow

Introduction

Suppose you have hundreds of components to be registered. You can use AddComponent, or you can add a component entry on the configuration file. No matter what you choose, it is going to be hard.

This facility allows you to register components using include and exclude rules. The facility might also register components in a specific assembly that uses the CastleComponentAttribute.

Quick Note

This facility is obsolete since now Windsor is able to register components based on the configuration.

Quick start

Just register the facility on the container and create the configuration node.

Configuration Schema


<facilities>
  <facility id="batchreg">
    <assemblyBatch name="assembly name" useAttributes="true|false">
      <include key="component key" service="service interface typename" component="service implementation typename" />
      <exclude type="typename to exclude" />
    </assemblyBatch>
  </facility>
</facilities>    

Example

The configuration below will register all public classes within Company.Common.Components assembly that uses the CastleComponent attribute, but will exclude class WorkflowEngine:


<facilities>
  <facility id="batchreg">
    <assemblyBatch name="Company.Common.Components" useAttributes="true">
      <exclude type="Company.Common.Components.WorkflowEngine, Company.Common.Components" />
    </assemblyBatch>
  </facility>
</facilities>

The configuration below will register only the components specified in the include nodes.


<facilities>
  <facility id="batchreg">
    <assemblyBatch name="Company.Common.Components">
      <include key="engine" 
        service="Company.Common.Components.IWorkflowEngine" 
        component="Company.Common.Components.DefaultWorkflowEngine" />
    </assemblyBatch>
  </facility>
</facilities>

Required Assemblies

Google
Search WWW Search castleproject.org