コード例 #1
0
        /// <summary>
        /// Constructor to modify the applied registrator
        /// </summary>
        /// <param name="registrator">Registrator replacement</param>
        internal CastleContainer(ComponentRegistrator registrator)
        {
            // Boot up the container and give it to the registrator
            Container   = registrator.Container = new WindsorContainer();
            Registrator = registrator;

            Container.AddFacility <TypedFactoryFacility>();
            Container.AddFacility <MoryxFacility>();

            // Self registration for framework functionality
            SetInstance <IContainer>(this);
        }
コード例 #2
0
        private bool TypeRequired(Type foundType)
        {
            // Check if interface was specified as required
            if (foundType.IsInterface && _depReg.RequiredTypes.Contains(foundType))
            {
                return(true);
            }

            // Check if class exports required type
            if (foundType.IsClass && _depReg.RequiredTypes.Intersect(ComponentRegistrator.GetComponentServices(foundType)).Any())
            {
                return(true);
            }

            return(false);
        }