--HG--
branch : 1.x
This commit is contained in:
Andre Rodrigues
2011-06-09 15:51:47 -07:00
6 changed files with 25 additions and 5 deletions

View File

@@ -63,8 +63,6 @@
<add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"/>
<add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"/>
<add assembly="System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<remove assembly="mscorlib" />
<remove assembly="System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<remove assembly="System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<remove assembly="System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<remove assembly="System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />

View File

@@ -247,7 +247,20 @@ namespace Orchard.Environment.Extensions {
}
private IEnumerable<ExtensionProbeEntry> SortExtensionProbeEntries(IEnumerable<ExtensionProbeEntry> entries, ConcurrentDictionary<string, DateTime> virtualPathModficationDates) {
return entries
// All "entries" are for the same extension ID, so we just need to filter/sort them by priority+ modification dates.
var groupByPriority = entries
.GroupBy(entry => entry.Priority)
.OrderByDescending(g => g.Key);
// Select highest priority group with at least one item
var firstNonEmptyGroup = groupByPriority.FirstOrDefault(g => g.Count() >= 1) ?? Enumerable.Empty<ExtensionProbeEntry>();
// No need for further sorting if only 1 item found
if (firstNonEmptyGroup.Count() <= 1)
return firstNonEmptyGroup;
// Sort by last modification date/loader order
return firstNonEmptyGroup
.OrderByDescending(probe => GetVirtualPathDepedenciesModificationTimeUtc(virtualPathModficationDates, probe))
.ThenBy(probe => probe.Loader.Order)
.ToList();

View File

@@ -32,6 +32,7 @@ namespace Orchard.Environment.Extensions.Loaders {
return new ExtensionProbeEntry {
Descriptor = descriptor,
Loader = this,
Priority = 100, // Higher priority because assemblies in ~/bin always take precedence
VirtualPath = "~/Core/" + descriptor.Id,
VirtualPathDependencies = Enumerable.Empty<string>(),
};

View File

@@ -9,6 +9,7 @@ namespace Orchard.Environment.Extensions.Loaders {
public class ExtensionProbeEntry {
public ExtensionDescriptor Descriptor { get; set; }
public IExtensionLoader Loader { get; set; }
public int Priority { get; set; }
public string VirtualPath { get; set; }
public IEnumerable<string> VirtualPathDependencies { get; set; }
}

View File

@@ -1,4 +1,5 @@
using System.IO;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Orchard.Environment.Extensions.Models;
using Orchard.FileSystems.Dependencies;
@@ -59,6 +60,7 @@ namespace Orchard.Environment.Extensions.Loaders {
return new ExtensionProbeEntry {
Descriptor = descriptor,
Loader = this,
Priority = 100, // Higher priority because assemblies in ~/bin always take precedence
VirtualPath = assemblyPath,
VirtualPathDependencies = new[] { assemblyPath },
};

View File

@@ -113,7 +113,12 @@ namespace Orchard.HostContext {
}
private static CommandHost CreateWorkerAppDomainWithHost(string virtualPath, string physicalPath, Type hostType) {
ClientBuildManager clientBuildManager = new ClientBuildManager(virtualPath, physicalPath);
var clientBuildManager = new ClientBuildManager(virtualPath, physicalPath);
// Fix for http://orchard.codeplex.com/workitem/17920
// By forcing the CBM to build App_Code, etc, we ensure that the ASP.NET BuildManager
// is in a state where it can safely (i.e. in a multi-threaded safe way) process
// multiple concurrent calls to "GetCompiledAssembly".
clientBuildManager.CompileApplicationDependencies();
return (CommandHost)clientBuildManager.CreateObject(hostType, false);
}
}