In Unity, what is the difference between the 2 ways to register a singleton instance?

Viewed 8477

In Unity, as I know I can use the following 2 options to register a singleton instance:

        IConfiguration globalConfig = new Configuration();
        container.RegisterInstance<IConfiguration>(globalConfig);

        container.RegisterType<IConfiguration, Configuration>(new ContainerControlledLifetimeManager()); 

Is there any difference between these 2 ways? What is the preferred way to register a singleton instance?

2 Answers
Related