private static void Init() { try { string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "autofac.json"); var config = new ConfigurationBuilder(); config.AddJsonFile(path); // Register the ConfigurationModule with Autofac. var module = new ConfigurationModule(config.Build()); var builder = new ContainerBuilder(); builder.RegisterModule(module); builder.Register <CryptoProvider>(o => ProviderFactory.CreateCryptoProvider()); m_Container = builder.Build(); } catch (Exception ex) { throw ex; } }