How to write a module for another container

Xray has been written to try to accommodate multiple IoC containers, this is done by implementing an abstract class XrayClient.

XrayClient is an abstract class located in Xray.Common dll. To create a module for another IoC, reference this dll and create a sub class of the XrayClient class.

You will have to implement the abstract method

        /// <summary>
        /// populates a model with all the information from the container, all the components it contains and
        /// their dependencies
        /// </summary>
        /// <returns>the model is returned</returns>
        protected abstract Model PopulateModel();

once this has successfully implemented, you should be able to use it

        XrayClient xray = new XrayWindsor(container);

an example

    public class XrayYourContainer : XrayClient
        private readonly IContainer _container;

        public XrayYourContainer(IContainer container)
            _container = container;

        protected override Model PopulateModel()
            Model model = new Model();

            //get the components
            //update with ctor dependents
            //Update property dependencies
            return model;

Last edited Feb 27, 2011 at 6:26 PM by dbones, version 1


No comments yet.