This project is read-only.


ComponentContainer manages components, message channels and services. It cannot be instantiated. You derive your own ComponentContainer from the base class. Your custom container can contain one or multiple message channels (eg. one for standard messages and other for high priority messages or error reporting). Additionally it can contain services and global variables.

In the method ComponentContainer.Add(object component) each parameter is analyzed using refactoring. Each component method marked with MessageSubscriberAttribute is added to the subscriber list of the matching message channel.

ComponentContainer as a ServiceContainer

Components after adding them to the ComponentContainer can be referenced by their types.

var now = Env.MyComponentContainer.First<ITimeProvider>().Now;


    public class MyComponentContainer : ComponentContainer
        public MessageChannel Messages {...}

        // TimeProvider can be explicitly defined and initialized with MEF or it can be added to the 
        // components collection using the ComponentContainer.Add() method
        public ITimeProvider TimeProvider { get; set; }

Last edited Jan 13, 2013 at 8:53 AM by polo, version 2


No comments yet.