/// <summary>
        /// Creates a <see cref="T:System.ServiceModel.ServiceHost"/> for a specified type of service with a specific base address.
        /// </summary>
        /// <param name="serviceType">Specifies the type of service to host.</param>
        /// <param name="baseAddresses">The <see cref="T:System.Array"/> of type <see cref="T:System.Uri"/> that contains the base addresses for the service hosted.</param>
        /// <returns>
        /// A <see cref="T:System.ServiceModel.ServiceHost"/> for the type of service specified with a specific base address.
        /// </returns>
        protected override ServiceHost CreateServiceHost(Type serviceType, Uri[] baseAddresses)
        {
            if (serviceType == null)
            {
                throw new ArgumentNullException("serviceType");
            }

            ServiceBehaviorAttribute attribute;
            var lifetime = GetLifetime(serviceType, out attribute);

            if (_container == null)
            {
                var registrar = new ContainerRegistrar();
                registrar.RegisterConcrete(serviceType, lifetime);
                registrar.RegisterModules(serviceType.Assembly);
                _container = registrar.Build();
            }

            var host = new ServiceLocatorServiceHost(_container, serviceType, baseAddresses);

            if (ConfigurationCallback != null)
            {
                ConfigurationCallback(host);
            }

            return(host);
        }
        public void ResolveFromModules()
        {
            var registrar = new ContainerRegistrar();
            registrar.RegisterModules(Assembly.GetExecutingAssembly());
            var builder = new ContainerBuilder();
            var container = builder.Build(registrar);

            container.Resolve<MySelf>();
        }
        public void ResolveFromModules()
        {
            var registrar = new ContainerRegistrar();

            registrar.RegisterModules(Assembly.GetExecutingAssembly());
            var builder   = new ContainerBuilder();
            var container = builder.Build(registrar);

            container.Resolve <MySelf>();
        }
        /// <summary>
        /// Creates a <see cref="T:System.ServiceModel.ServiceHost"/> for a specified type of service with a specific base address.
        /// </summary>
        /// <param name="serviceType">Specifies the type of service to host.</param>
        /// <param name="baseAddresses">The <see cref="T:System.Array"/> of type <see cref="T:System.Uri"/> that contains the base addresses for the service hosted.</param>
        /// <returns>
        /// A <see cref="T:System.ServiceModel.ServiceHost"/> for the type of service specified with a specific base address.
        /// </returns>
        protected override ServiceHost CreateServiceHost(Type serviceType, Uri[] baseAddresses)
        {
            if (serviceType == null) throw new ArgumentNullException("serviceType");

            ServiceBehaviorAttribute attribute;
            var lifetime = GetLifetime(serviceType, out attribute);

            if (_container == null)
            {
                var registrar = new ContainerRegistrar();
                registrar.RegisterConcrete(serviceType, lifetime);
                registrar.RegisterModules(serviceType.Assembly);
                _container = registrar.Build();
            }

            var host = new ServiceLocatorServiceHost(_container, serviceType, baseAddresses);
            if (ConfigurationCallback != null)
                ConfigurationCallback(host);

            return host;
        }