Created
February 13, 2011 09:16
-
-
Save takeshik/824558 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public IModule Add(String key, String typeName, IList<String> options, FileInfo configFile) | |
{ | |
this.CheckIfDisposed(); | |
Tuple<String, String> id = Tuple.Create(key, typeName); | |
return this.Modules.ContainsKey(id) | |
? this.Modules[id] | |
: Activator.CreateInstance( | |
this.AppDomain, | |
this.GetAssemblyByName(typeName).FullName, | |
typeName | |
).Unwrap() | |
.If( | |
o => o is Storage, | |
s => ((StorageModule) Activator.CreateInstance( | |
this.AppDomain, | |
typeof(StorageModule).Assembly.FullName, | |
typeof(StorageModule).FullName, | |
false, | |
BindingFlags.Default, | |
null, | |
Make.Array(s), | |
null, | |
null | |
).Unwrap()), | |
o => (IModule) o | |
) | |
.Apply( | |
m => m.Register(this, key, options), | |
this.Modules.Add, | |
m => this.Log.Info(Resources.ModuleAssemblyLoaded, this.Key, key, typeName), | |
m => m.Configure(configFile), | |
m => m.Initialize() | |
); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment