public static IComponentResolverConfiguration Configuration() { var result = new ComponentResolverConfiguration(); var section = ConfigurationSectionProvider.Open <ComponentResolverSection>("shuttle", "componentResolver"); if (section == null) { return(result); } foreach (ComponentResolverElement component in section.Components) { var dependencyType = Type.GetType(component.DependencyType); if (dependencyType == null) { throw new ConfigurationErrorsException( string.Format(InfrastructureResources.MissingTypeException, component.DependencyType)); } result.AddComponent(new ComponentResolverConfiguration.Component(dependencyType)); } return(result); }
public static IBootstrapConfiguration Configuration() { var result = new BootstrapConfiguration(); var section = ConfigurationSectionProvider.Open <BootstrapSection>("shuttle", "bootstrap"); var reflectionService = new ReflectionService(); if (section != null) { result.Scan = section.Scan; foreach (BootstrapAssemblyElement assemblyElement in section.Assemblies) { var assembly = reflectionService.FindAssemblyNamed(assemblyElement.Name); if (assembly == null) { throw new ConfigurationErrorsException(string.Format(InfrastructureResources.AssemblyNameNotFound, assemblyElement.Name)); } result.AddAssembly(assembly); } } if (result.Scan != BootstrapScan.None) { foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies()) { result.AddAssembly(assembly); } } switch (result.Scan) { case BootstrapScan.All: { foreach (var assembly in reflectionService.GetAssemblies()) { result.AddAssembly(assembly); } break; } case BootstrapScan.Shuttle: { foreach (var assembly in reflectionService.GetMatchingAssemblies("^Shuttle\\.")) { result.AddAssembly(assembly); } break; } } return(result); }
public static TransactionScopeSection Get() { lock (Padlock) { if (!_initialized) { _section = ConfigurationSectionProvider.Open <TransactionScopeSection>("shuttle", "transactionScope"); _initialized = true; } return(_section); } }
private void ReadConfiguration() { var section = ConfigurationSectionProvider.Open <TripleDESSection>("shuttle", "tripleDES"); if (section == null) { throw new ConfigurationErrorsException(InfrastructureResources.TripleDESSectionMissing); } key = section.Key; if (string.IsNullOrEmpty(key)) { throw new ConfigurationErrorsException(InfrastructureResources.TripleDESKeyMissing); } _provider = new TripleDESCryptoServiceProvider { IV = new byte[8], Key = new PasswordDeriveBytes(key, new byte[0]).CryptDeriveKey("RC2", "MD5", 128, new byte[8]) }; }
public static IComponentRegistryConfiguration Configuration() { var result = new ComponentRegistryConfiguration(); var section = ConfigurationSectionProvider.Open <ComponentRegistrySection>("shuttle", "componentRegistry"); if (section == null) { return(result); } foreach (ComponentRegistryComponentElement component in section.Components) { var dependencyType = Type.GetType(component.DependencyType); if (dependencyType == null) { throw new ConfigurationErrorsException(string.Format(InfrastructureResources.MissingTypeException, component.DependencyType)); } var implementationType = string.IsNullOrEmpty(component.ImplementationType) ? dependencyType : Type.GetType(component.ImplementationType); if (implementationType == null) { throw new ConfigurationErrorsException(string.Format(InfrastructureResources.MissingTypeException, component.ImplementationType)); } result.AddComponent( new ComponentRegistryConfiguration.Component(dependencyType, implementationType, component.Lifestyle)); } foreach (ComponentRegistryCollectionElement collection in section.Collections) { var dependencyType = Type.GetType(collection.DependencyType); var implementationTypes = new List <Type>(); if (dependencyType == null) { throw new ConfigurationErrorsException(string.Format(InfrastructureResources.MissingTypeException, collection.DependencyType)); } foreach (ComponentRegistryCollectionImplementationTypeElement element in collection) { var implementationType = Type.GetType(element.ImplementationType); if (implementationType == null) { throw new ConfigurationErrorsException(string.Format( InfrastructureResources.MissingTypeException, element.ImplementationType)); } implementationTypes.Add(implementationType); } result.AddCollection( new ComponentRegistryConfiguration.Collection(dependencyType, implementationTypes, collection.Lifestyle)); } return(result); }