コード例 #1
0
 public void Install(IInstaller installer)
 {
     if (_installedInstallers.Where(x => x.GetType() == installer.GetType()).IsEmpty())
     // Do not install the same installer twice
     {
         _installedInstallers.Add(installer);
         this.Inject(installer);
         installer.InstallBindings();
     }
 }
コード例 #2
0
ファイル: DiContainer.cs プロジェクト: zeljkokalezic/Zenject
 void InstallInstallerInternal(IInstaller installer)
 {
     try
     {
         installer.InstallBindings();
     }
     catch (Exception e)
     {
         // This context information is really helpful when bind commands fail
         throw new Exception(
                   "Error occurred while running installer '{0}'".Fmt(installer.GetType().Name()), e);
     }
 }
コード例 #3
0
 protected void InstallBindings <T>(List <T> installers) where T : IInstaller
 {
     if (installers != null)
     {
         for (int i = 0; i < installers.Count; i++)
         {
             IInstaller installer = installers[i];
             if (installer != null)
             {
                 installer.InstallBindings(Container);
             }
             else
             {
                 throw new System.NullReferenceException(string.Format("Null installer reference found in context '{0}'", name));
             }
         }
     }
 }