コード例 #1
0
ファイル: Autofacbootstrapper.cs プロジェクト: ajayumi/AiXin
        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;
            }
        }