Esempio n. 1
0
        private static void SetupIoCContainer()
        {
            ContainerBuilder builder = new ContainerBuilder();

            // Let AspComet put its registrations into the container
            foreach (ServiceMetadata metadata in ServiceMetadata.GetMinimumSet())
            {
                if (metadata.IsPerRequest)
                {
                    builder.RegisterType(metadata.ActualType).As(metadata.ServiceType);
                }
                else
                {
                    builder.RegisterType(metadata.ActualType).As(metadata.ServiceType).SingleInstance();
                }
            }

            // Add our own stuff to the container
            builder.RegisterType <AuthenticatedClientFactory>().As <IClientFactory>().SingleInstance();
            builder.RegisterType <HandshakeAuthenticator>().SingleInstance();
            builder.RegisterType <BadLanguageBlocker>().SingleInstance();
            builder.RegisterType <SubscriptionChecker>().SingleInstance();
            builder.RegisterType <Whisperer>().SingleInstance();

            // Set up the common service locator
            container = builder.Build();
        }