mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
Switch to MVC3/Razor1 beta release
--HG-- branch : dev
This commit is contained in:
@@ -26,6 +26,7 @@ using Orchard.Mvc.Routes;
|
||||
using Orchard.Tests.Environment.TestDependencies;
|
||||
using Orchard.Tests.Stubs;
|
||||
using Orchard.Tests.Utility;
|
||||
using IModelBinderProvider = Orchard.Mvc.ModelBinders.IModelBinderProvider;
|
||||
|
||||
namespace Orchard.Tests.Environment {
|
||||
[TestFixture]
|
||||
|
@@ -8,6 +8,7 @@ using NUnit.Framework;
|
||||
using Orchard.Environment;
|
||||
using Orchard.Mvc.ModelBinders;
|
||||
using Orchard.Mvc.Routes;
|
||||
using IModelBinderProvider = Orchard.Mvc.ModelBinders.IModelBinderProvider;
|
||||
|
||||
namespace Orchard.Tests.Environment {
|
||||
[TestFixture]
|
||||
|
@@ -3,6 +3,7 @@ using System.Web.Mvc;
|
||||
using System.Xml;
|
||||
using System.Xml.Linq;
|
||||
using Orchard.Mvc.ModelBinders;
|
||||
using IModelBinderProvider = Orchard.Mvc.ModelBinders.IModelBinderProvider;
|
||||
|
||||
namespace Orchard.Core.XmlRpc.Models {
|
||||
public class ModelBinderProvider : IModelBinderProvider, IModelBinder {
|
||||
|
@@ -83,9 +83,9 @@
|
||||
<Compile Include="ViewModels\SetupViewModel.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Views\Setup\Index.cshtml">
|
||||
<None Include="Views\Setup\Index.cshtml">
|
||||
<SubType>Designer</SubType>
|
||||
</Content>
|
||||
</None>
|
||||
<Content Include="Web.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
@@ -72,18 +72,43 @@
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Web" />
|
||||
<Reference Include="System.Web.Abstractions" />
|
||||
<Reference Include="System.Web.Helpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\lib\aspnetmvc\System.Web.Helpers.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\lib\aspnetmvc\System.Web.Mvc.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\lib\aspnetmvc\System.Web.Razor.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.Routing" />
|
||||
<Reference Include="System.Web.WebPages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\lib\aspnetmvc\System.Web.WebPages.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\lib\aspnetmvc\System.Web.WebPages.Razor.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Web.Services" />
|
||||
<Reference Include="System.EnterpriseServices" />
|
||||
<Reference Include="System.Web.Mobile" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="WebMatrix.Data, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\lib\aspnetmvc\WebMatrix.Data.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Default.aspx.cs">
|
||||
@@ -163,7 +188,7 @@
|
||||
<Content Include="Themes\Classic\Theme.png" />
|
||||
<Content Include="Themes\Classic\Theme.txt" />
|
||||
<Content Include="Themes\Classic\Views\Footer.cshtml" />
|
||||
<Content Include="Themes\Classic\Views\Layout.cshtml" />
|
||||
<Content Include="Themes\Classic\Views\Layout.ascx" />
|
||||
<Content Include="Themes\Contoso\Content\Images\bkg.jpg" />
|
||||
<Content Include="Themes\Contoso\Content\Images\comment-arrow.png" />
|
||||
<Content Include="Themes\Contoso\Content\Images\content-bkg.png" />
|
||||
|
@@ -9,17 +9,17 @@
|
||||
-->
|
||||
<configuration>
|
||||
<configSections>
|
||||
<sectionGroup name="system.razor.web" type="System.Razor.Web.Configuration.SystemRazorWebSectionGroup, System.Razor.Web">
|
||||
<section name="host" type="System.Razor.Web.Configuration.HostSection, System.Razor.Web" requirePermission="false" />
|
||||
<section name="pages" type="System.Razor.Web.Configuration.RazorPagesSection, System.Razor.Web" requirePermission="false" />
|
||||
<sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor">
|
||||
<section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor" requirePermission="false" />
|
||||
<section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor" requirePermission="false" />
|
||||
</sectionGroup>
|
||||
</configSections>
|
||||
|
||||
<appSettings/>
|
||||
<system.diagnostics configSource="Config\Diagnostics.config"/>
|
||||
|
||||
<system.razor.web>
|
||||
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
|
||||
|
||||
<system.web.webPages.razor>
|
||||
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
|
||||
<pages pageBaseType="Orchard.Mvc.ViewEngines.Razor.WebViewPage">
|
||||
<namespaces>
|
||||
<add namespace="System.Web.Mvc" />
|
||||
@@ -31,7 +31,7 @@
|
||||
<add namespace="Orchard.Mvc.Html"/>
|
||||
</namespaces>
|
||||
</pages>
|
||||
</system.razor.web>
|
||||
</system.web.webPages.razor>
|
||||
|
||||
<!--
|
||||
Set default transaction timeout to 30 minutes so that interactive debugging
|
||||
|
@@ -7,7 +7,7 @@ using Autofac;
|
||||
|
||||
namespace Orchard.Environment {
|
||||
|
||||
public class DefaultOrchardHostContainer : IOrchardHostContainer, IMvcServiceLocator {
|
||||
public class DefaultOrchardHostContainer : IOrchardHostContainer, IDependencyResolver {
|
||||
private readonly IContainer _container;
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace Orchard.Environment {
|
||||
TService Resolve<TService>(Type serviceType, Func<Type, TService> defaultFactory) {
|
||||
object value;
|
||||
return TryResolve(null, serviceType, out value) ? (TService)value : defaultFactory(serviceType);
|
||||
}
|
||||
}
|
||||
|
||||
TService Resolve<TService>(Type serviceType, string key, Func<Type, TService> defaultFactory) {
|
||||
object value;
|
||||
@@ -60,43 +60,12 @@ namespace Orchard.Environment {
|
||||
return Resolve(typeof(TService), default(TService));
|
||||
}
|
||||
|
||||
object IServiceProvider.GetService(Type serviceType) {
|
||||
object IDependencyResolver.GetService(Type serviceType) {
|
||||
// Resolve service, or null
|
||||
return Resolve(serviceType, default(object));
|
||||
}
|
||||
|
||||
object IServiceLocator.GetInstance(Type serviceType) {
|
||||
// Create instance, or default ctor
|
||||
return Resolve(serviceType, CreateInstance);
|
||||
}
|
||||
|
||||
object IServiceLocator.GetInstance(Type serviceType, string key) {
|
||||
// Create instance, or default ctor
|
||||
return Resolve(serviceType, key, CreateInstance);
|
||||
}
|
||||
|
||||
TService IServiceLocator.GetInstance<TService>() {
|
||||
// Create instance, or default ctor
|
||||
return Resolve(typeof(TService), t => (TService)CreateInstance(t));
|
||||
}
|
||||
|
||||
TService IServiceLocator.GetInstance<TService>(string key) {
|
||||
// Create instance, or default ctor
|
||||
return Resolve(typeof(TService), key, t => (TService)CreateInstance(t));
|
||||
}
|
||||
|
||||
IEnumerable<TService> IServiceLocator.GetAllInstances<TService>() {
|
||||
return Resolve(typeof(IEnumerable<TService>), Enumerable.Empty<TService>());
|
||||
}
|
||||
|
||||
IEnumerable<object> IServiceLocator.GetAllInstances(Type serviceType) {
|
||||
return Resolve<IEnumerable>(typeof(IEnumerable<>).MakeGenericType(serviceType), Enumerable.Empty<object>()).Cast<object>();
|
||||
}
|
||||
|
||||
void IMvcServiceLocator.Release(object instance) {
|
||||
// Autofac manages component disposal lifecycle internally.
|
||||
}
|
||||
|
||||
|
||||
IEnumerable<object> IDependencyResolver.GetServices(Type serviceType) {
|
||||
return Resolve<IEnumerable>(typeof(IEnumerable<>).MakeGenericType(serviceType), Enumerable.Empty<object>()).Cast<object>();
|
||||
}
|
||||
}
|
||||
|
@@ -8,6 +8,7 @@ using Orchard.Environment.Extensions.Models;
|
||||
using Orchard.Logging;
|
||||
using Orchard.Mvc.ModelBinders;
|
||||
using Orchard.Mvc.Routes;
|
||||
using IModelBinderProvider = Orchard.Mvc.ModelBinders.IModelBinderProvider;
|
||||
|
||||
namespace Orchard.Environment {
|
||||
public class DefaultOrchardShell : IOrchardShell {
|
||||
|
@@ -3,12 +3,11 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using System.Web.Mvc;
|
||||
using System.Web.UI;
|
||||
using Microsoft.WebPages;
|
||||
using System.Web.WebPages;
|
||||
using Orchard.Localization;
|
||||
using Orchard.Mvc.ViewEngines;
|
||||
using Orchard.UI.PageClass;
|
||||
using Orchard.UI.PageTitle;
|
||||
using Orchard.UI.Resources;
|
||||
using HtmlHelper = System.Web.Mvc.HtmlHelper;
|
||||
|
||||
namespace Orchard.Mvc.Html {
|
||||
|
@@ -1,9 +1,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Razor.Web;
|
||||
using System.Reflection;
|
||||
using System.Threading;
|
||||
using System.Web.WebPages.Razor;
|
||||
using Orchard.Environment;
|
||||
using Orchard.Environment.Extensions.Loaders;
|
||||
using Orchard.FileSystems.Dependencies;
|
||||
|
@@ -3,13 +3,13 @@ using System.Diagnostics;
|
||||
using System.Web.Mvc;
|
||||
|
||||
namespace Orchard.Mvc.ViewEngines.Razor {
|
||||
public class RazorViewEngine : CshtmlViewEngine {
|
||||
[DebuggerStepThrough]
|
||||
protected override bool FileExists(ControllerContext controllerContext, string virtualPath) {
|
||||
if (!virtualPath.EndsWith(".cshtml", StringComparison.InvariantCultureIgnoreCase))
|
||||
return false;
|
||||
public class RazorViewEngine : System.Web.Mvc.RazorViewEngine {
|
||||
//[DebuggerStepThrough]
|
||||
//protected override bool FileExists(ControllerContext controllerContext, string virtualPath) {
|
||||
// if (!virtualPath.EndsWith(".cshtml", StringComparison.InvariantCultureIgnoreCase))
|
||||
// return false;
|
||||
|
||||
return base.FileExists(controllerContext, virtualPath);
|
||||
}
|
||||
// return base.FileExists(controllerContext, virtualPath);
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
@@ -50,7 +50,7 @@ namespace Orchard.Mvc.ViewEngines.Razor {
|
||||
|
||||
//Logger.Debug("AreaPartialViewLocationFormats (theme): \r\n\t-{0}", string.Join("\r\n\t-", areaPartialViewLocationFormats));
|
||||
|
||||
var viewEngine = new CshtmlViewEngine {
|
||||
var viewEngine = new RazorViewEngine {
|
||||
MasterLocationFormats = DisabledFormats,
|
||||
ViewLocationFormats = DisabledFormats,
|
||||
PartialViewLocationFormats = partialViewLocationFormats,
|
||||
|
@@ -1,8 +1,8 @@
|
||||
using System;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
using System.Web.WebPages;
|
||||
using Autofac;
|
||||
using Microsoft.WebPages;
|
||||
using Orchard.DisplayManagement;
|
||||
using Orchard.Localization;
|
||||
using Orchard.Mvc.Html;
|
||||
|
@@ -5,26 +5,26 @@ using System.Web.Mvc;
|
||||
|
||||
namespace Orchard.Mvc.ViewEngines.WebForms {
|
||||
public class WebFormViewEngineForAspNet4 : WebFormViewEngine {
|
||||
protected override bool FileExists(ControllerContext controllerContext, string virtualPath) {
|
||||
try {
|
||||
if (virtualPath.EndsWith(".aspx", StringComparison.InvariantCultureIgnoreCase) ||
|
||||
virtualPath.EndsWith(".ascx", StringComparison.InvariantCultureIgnoreCase) ||
|
||||
virtualPath.EndsWith(".master", StringComparison.InvariantCultureIgnoreCase)) {
|
||||
return BuildManager.GetObjectFactory(virtualPath, false) != null;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
catch (HttpException exception) {
|
||||
// Reproducing base class behavior, however these this code path should
|
||||
// not be followed for "not found" cases
|
||||
if (exception is HttpParseException) {
|
||||
throw;
|
||||
}
|
||||
if ((exception.GetHttpCode() != 0x194) || base.FileExists(controllerContext, virtualPath)) {
|
||||
throw;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
//protected override bool FileExists(ControllerContext controllerContext, string virtualPath) {
|
||||
// try {
|
||||
// if (virtualPath.EndsWith(".aspx", StringComparison.InvariantCultureIgnoreCase) ||
|
||||
// virtualPath.EndsWith(".ascx", StringComparison.InvariantCultureIgnoreCase) ||
|
||||
// virtualPath.EndsWith(".master", StringComparison.InvariantCultureIgnoreCase)) {
|
||||
// return BuildManager.GetObjectFactory(virtualPath, false) != null;
|
||||
// }
|
||||
// return false;
|
||||
// }
|
||||
// catch (HttpException exception) {
|
||||
// // Reproducing base class behavior, however these this code path should
|
||||
// // not be followed for "not found" cases
|
||||
// if (exception is HttpParseException) {
|
||||
// throw;
|
||||
// }
|
||||
// if ((exception.GetHttpCode() != 0x194) || base.FileExists(controllerContext, virtualPath)) {
|
||||
// throw;
|
||||
// }
|
||||
// return false;
|
||||
// }
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
@@ -102,11 +102,6 @@
|
||||
<Reference Include="Microsoft.Scripting">
|
||||
<HintPath>..\..\lib\dlr\Microsoft.Scripting.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.WebPages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\lib\aspnetmvc\Microsoft.WebPages.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="NHibernate, Version=2.1.0.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\lib\fluentnhibernate\NHibernate.dll</HintPath>
|
||||
@@ -124,10 +119,6 @@
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Razor.Web, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\lib\aspnetmvc\System.Razor.Web.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Runtime.Serialization">
|
||||
<RequiredTargetFramework>3.0</RequiredTargetFramework>
|
||||
</Reference>
|
||||
@@ -141,9 +132,18 @@
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\lib\aspnetmvc\System.Web.Mvc.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\lib\aspnetmvc\System.Web.Razor.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.Routing">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.WebPages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\lib\aspnetmvc\System.Web.WebPages.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="Yaml, Version=1.0.3370.39839, Culture=neutral, PublicKeyToken=187a3d240e44a135, processorArchitecture=MSIL">
|
||||
|
@@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using System.Web.Mvc;
|
||||
using System.Web.UI;
|
||||
using Microsoft.WebPages;
|
||||
using System.Web.WebPages;
|
||||
|
||||
namespace Orchard.UI.Resources {
|
||||
public class ResourceRegister {
|
||||
|
Reference in New Issue
Block a user