示例#1
0
 public DependencyProvider(DependencyConfiguration dependencyConfiguration)
 {
     if (Validate(dependencyConfiguration))
     {
         this.dependencyConfiguration = dependencyConfiguration;
         Implementations = new ConcurrentStack <Type>();
     }
     else
     {
         throw new Exception("Dependency Configuration is not valid");
     }
 }
示例#2
0
 private bool Validate(DependencyConfiguration dependencyConfiguration)
 {
     if (dependencyConfiguration != null)
     {
         foreach (var kvpair in dependencyConfiguration.Configuration)
         {
             foreach (var confType in kvpair.Value)
             {
                 if (confType.Implementation.IsAbstract || confType.Implementation.IsInterface || !confType.ImplementationInterface.IsAssignableFrom(confType.Implementation))
                 {
                     return(false);
                 }
             }
         }
         return(true);
     }
     else
     {
         return(false);
     }
 }