Switch to MVC3/Razor1 beta release

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