diff options
| author | ebr11 Eric Reed spam <ebr11 Eric Reed spam@reedsplace.com> | 2012-09-20 13:54:37 -0400 |
|---|---|---|
| committer | ebr11 Eric Reed spam <ebr11 Eric Reed spam@reedsplace.com> | 2012-09-20 13:54:37 -0400 |
| commit | 7ed11c0bbae55cd2d5c559a2ef6af8f20edebeef (patch) | |
| tree | f96d8d2ba2b3ba71b7b31f012fcdd80ae09f0868 /MediaBrowser.Common/Kernel/BaseKernel.cs | |
| parent | da618f13e23cbef6ca71c8c0099dfd563a394fa5 (diff) | |
| parent | 119dfc3ac70db7536e86191eb3c89ffa1fd4f576 (diff) | |
Merge with default
Diffstat (limited to 'MediaBrowser.Common/Kernel/BaseKernel.cs')
| -rw-r--r-- | MediaBrowser.Common/Kernel/BaseKernel.cs | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/MediaBrowser.Common/Kernel/BaseKernel.cs b/MediaBrowser.Common/Kernel/BaseKernel.cs index 5a0e1c5e5..a6081a688 100644 --- a/MediaBrowser.Common/Kernel/BaseKernel.cs +++ b/MediaBrowser.Common/Kernel/BaseKernel.cs @@ -1,5 +1,6 @@ using MediaBrowser.Common.Events;
using MediaBrowser.Common.Logging;
+using MediaBrowser.Common.Mef;
using MediaBrowser.Common.Net;
using MediaBrowser.Common.Net.Handlers;
using MediaBrowser.Common.Plugins;
@@ -10,6 +11,7 @@ using System; using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.ComponentModel.Composition.Hosting;
+using System.ComponentModel.Composition.Primitives;
using System.IO;
using System.Linq;
using System.Reflection;
@@ -88,6 +90,9 @@ namespace MediaBrowser.Common.Kernel /// </summary>
private IDisposable HttpListener { get; set; }
+ /// <summary>
+ /// Gets the MEF CompositionContainer
+ /// </summary>
private CompositionContainer CompositionContainer { get; set; }
protected virtual string HttpServerUrlPrefix
@@ -184,18 +189,20 @@ namespace MediaBrowser.Common.Kernel // This will prevent the .dll file from getting locked, and allow us to replace it when needed
IEnumerable<Assembly> pluginAssemblies = Directory.GetFiles(ApplicationPaths.PluginsPath, "*.dll", SearchOption.TopDirectoryOnly).Select(f => Assembly.Load(File.ReadAllBytes((f))));
- var catalog = new AggregateCatalog(pluginAssemblies.Select(a => new AssemblyCatalog(a)));
+ var catalogs = new List<ComposablePartCatalog>();
+
+ catalogs.AddRange(pluginAssemblies.Select(a => new AssemblyCatalog(a)));
// Include composable parts in the Common assembly
- catalog.Catalogs.Add(new AssemblyCatalog(Assembly.GetExecutingAssembly()));
+ catalogs.Add(new AssemblyCatalog(Assembly.GetExecutingAssembly()));
if (includeCurrentAssembly)
{
// Include composable parts in the subclass assembly
- catalog.Catalogs.Add(new AssemblyCatalog(GetType().Assembly));
+ catalogs.Add(new AssemblyCatalog(GetType().Assembly));
}
- return new CompositionContainer(catalog);
+ return MefUtils.GetSafeCompositionContainer(catalogs);
}
/// <summary>
|
