1

是否可以让 HotTowel 和 EntityFramework 6 一起工作?

我们的数据访问层已升级到 EF6。我们在 Web 层中对 EntityFramework 的唯一引用是 Web.Config

 <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />

 <entityFramework>
   <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework">
  <parameters>
      <parameter value="Data Source=.; Integrated Security=True; MultipleActiveResultSets=True" />
      </parameters>
   </defaultConnectionFactory>
</entityFramework>

我们无法更新 ER 版本 6,因为 HotTowel 有可用的微风更新。但是如何解决热毛巾

安装失败。回滚...安装包:将“Microsoft.AspNet.WebApi.OData 5.0.0”更新为“Microsoft.AspNet.WebApi.OData 4.0.30506”失败。找不到与“Microsoft.AspNet.WebApi.OData 4.0.30506”兼容的“Breeze.Server.WebApi2”版本。

编辑: 我们正在使用 HotTowel 的 KNOCKOUT.js 库版本。

4

2 回答 2

6

Web APi v2 发布时(与我的课程在同一周)有一个不兼容的地方。现在已解决,所以只需安装

Install-Package HotTowel.Angular.Breeze -pre
于 2013-11-06T04:36:57.490 回答
4

John Papas 的 QUICK 版本回答是的,我需要 HOtTowel 的 pre 版本,实际上更多的是 angularJS Pre 版本。但这并没有解决所有问题。我需要 ef6 的微风包以及 WEB.CONFIG 条目。

安装包 HotTowel.Angular.Breeze -pre

我还必须使用 Install-Package Breeze.WebApi2.EF6

查看他们的网站了解更多信息 为什么选择 Breeze 和 EF6

帮助它运行的详细说明。大约 12 小时后......以防万一有人遇到问题:我将其描述为 ef6、MVC5、Razor、Hottowel、AngularJs Breeze Knockout 组合 包组合

<packages>
  <package id="AngularJS.Animate" version="1.2.0-rc3" targetFramework="net45" />
  <package id="AngularJS.Core" version="1.2.0-rc3" targetFramework="net45" />
  <package id="AngularJS.Route" version="1.2.0-rc3" targetFramework="net45" />
  <package id="AngularJS.Sanitize" version="1.2.0-rc3" targetFramework="net45" />
  <package id="Antlr" version="3.5.0.2" targetFramework="net45" />
  <package id="Breeze.Client" version="1.4.5" targetFramework="net45" />
  <package id="Breeze.Server.ContextProvider" version="1.4.5" targetFramework="net45" />
  <package id="Breeze.Server.ContextProvider.EF6" version="1.4.5" targetFramework="net45" />
  <package id="Breeze.Server.WebApi2" version="1.4.5" targetFramework="net45" />
  <package id="Breeze.WebApi2.EF6" version="1.4.5" targetFramework="net45" />
  <package id="Durandal" version="2.0.1" targetFramework="net45" />
  <package id="Durandal.Router" version="1.2.0" targetFramework="net45" />
  <package id="Durandal.Transitions" version="2.0.0" targetFramework="net45" />
  <package id="EntityFramework" version="6.0.1" targetFramework="net45" />
  <package id="FontAwesome" version="4.0.0" targetFramework="net45" />
  <package id="HotTowel.Angular" version="2.0.1-rc3" targetFramework="net45" />
  <package id="HotTowel.Angular.Breeze" version="2.0.1-rc3" targetFramework="net45" />
  <package id="infuser" version="0.2.1" targetFramework="net45" />
  <package id="jQuery" version="2.0.3" targetFramework="net45" />
  <package id="jQuery.Form" version="3.32" targetFramework="net45" />
  <package id="jQuery.UI.Combined" version="1.10.3" targetFramework="net45" />
  <package id="jQuery.Validation" version="1.11.1" targetFramework="net45" />
  <package id="Knockout.js_External_Template_Engine" version="2.0.5" targetFramework="net45" />
  <package id="Knockout.Mapping" version="2.4.0" targetFramework="net45" />
  <package id="Knockout.Validation" version="1.0.1" targetFramework="net45" />
  <package id="knockoutjs" version="2.3.0" targetFramework="net45" />
  <package id="Microsoft.AspNet.Mvc" version="5.0.0" targetFramework="net45" />
  <package id="Microsoft.AspNet.Mvc.FixedDisplayModes" version="5.0.0" targetFramework="net45" />
  <package id="Microsoft.AspNet.Razor" version="3.0.0" targetFramework="net45" />
  <package id="Microsoft.AspNet.Web.Optimization" version="1.1.2" targetFramework="net45" />
  <package id="Microsoft.AspNet.WebApi" version="5.0.0" targetFramework="net45" />
  <package id="Microsoft.AspNet.WebApi.Client" version="5.0.0" targetFramework="net45" />
  <package id="Microsoft.AspNet.WebApi.Core" version="5.0.0" targetFramework="net45" />
  <package id="Microsoft.AspNet.WebApi.OData" version="5.0.0" targetFramework="net45" />
  <package id="Microsoft.AspNet.WebApi.Tracing" version="5.0.0" targetFramework="net45" />
  <package id="Microsoft.AspNet.WebApi.WebHost" version="5.0.0" targetFramework="net45" />
  <package id="Microsoft.AspNet.WebPages" version="3.0.0" targetFramework="net45" />
  <package id="Microsoft.Data.Edm" version="5.6.0" targetFramework="net45" />
  <package id="Microsoft.Data.OData" version="5.6.0" targetFramework="net45" />
  <package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net45" />
  <package id="Modernizr" version="2.6.2" targetFramework="net45" />
  <package id="Moment.js" version="2.1.0" targetFramework="net45" />
  <package id="Newtonsoft.Json" version="5.0.8" targetFramework="net45" />
  <package id="Q" version="0.9.7" targetFramework="net45" />
  <package id="RequireJS" version="2.1.8" targetFramework="net45" />
  <package id="RequireJS.Text" version="2.0.7" targetFramework="net45" />
  <package id="Sammy.js" version="0.7.4" targetFramework="net45" />
  <package id="Spin.js" version="1.3" targetFramework="net45" />
  <package id="System.Spatial" version="5.6.0" targetFramework="net45" />
  <package id="TinyMCE.JQuery" version="4.0.8" targetFramework="net45" />
  <package id="toastr" version="2.0.1" targetFramework="net45" />
  <package id="TrafficCop" version="0.3.1" targetFramework="net45" />
  <package id="Twitter.Bootstrap" version="2.3.2" targetFramework="net45" />
  <package id="Unity" version="3.0.1304.0" targetFramework="net45" />
  <package id="WebActivator" version="1.5.3" targetFramework="net45" />
  <package id="WebActivatorEx" version="2.0.2" targetFramework="net45" />
  <package id="WebGrease" version="1.5.2" targetFramework="net45" />
</packages>

和一些非常重要的 WEB.CONFIG 条目在 Views/ 下

<?xml version="1.0"?>
<configuration>
  <configSections>
    <sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
      <section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
      <section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
</sectionGroup>
  </configSections>

  <system.web.webPages.razor>
    <host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    <pages pageBaseType="System.Web.Mvc.WebViewPage">
      <namespaces>
    <add namespace="System.Web.Mvc" />
    <add namespace="System.Web.Mvc.Ajax" />
    <add namespace="System.Web.Mvc.Html" />
    <add namespace="System.Web.Optimization"/>
    <add namespace="System.Web.Routing" />
  </namespaces>
    </pages>
  </system.web.webPages.razor>

  <appSettings>
  <add key="webpages:Enabled" value="false" />
  </appSettings>

 <system.web>
  <httpHandlers>
    <add path="*" verb="*" type="System.Web.HttpNotFoundHandler"/>
  </httpHandlers>
  <pages
    validateRequest="false"
    pageParserFilterType="System.Web.Mvc.ViewTypeParserFilter, System.Web.Mvc, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
    pageBaseType="System.Web.Mvc.ViewPage, System.Web.Mvc, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
    userControlBaseType="System.Web.Mvc.ViewUserControl, System.Web.Mvc, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
   <controls>
    <add assembly="System.Web.Mvc, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" namespace="System.Web.Mvc" tagPrefix="mvc" />
   </controls>
 </pages>
</system.web>

 <system.webServer>
  <validation validateIntegratedModeConfiguration="false" />

 <handlers>
  <remove name="BlockViewHandler"/>
  <add name="BlockViewHandler" path="*" verb="*" preCondition="integratedMode" type="System.Web.HttpNotFoundHandler" />
 </handlers>
 </system.webServer>
 </configuration>

然后在 ROOT Web.Config 中,检查这些条目是否与版本有关

<add key="webpages:Version" value="3.0.0" />
<add key="webpages:Enabled" value="false" />
<add key="PreserveLoginUrl" value="true" />
<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />

不需要更改命名空间,但以防万一。

 <httpRuntime targetFramework="4.5" />
   <pages>
    <namespaces>
    <add namespace="System.Web.Helpers" />
    <add namespace="System.Web.Mvc" />
    <add namespace="System.Web.Mvc.Ajax" />
    <add namespace="System.Web.Mvc.Html" />
    <add namespace="System.Web.Optimization" />
    <add namespace="System.Web.Routing" />
    <add namespace="System.Web.WebPages" />
   </namespaces>
  </pages>

以及对版本的一些依赖程序集调整

<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
  <dependentAssembly>
    <assemblyIdentity name="System.Web.WebPages.Razor" publicKeyToken="31bf3856ad364e35" />
    <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
  </dependentAssembly>

  <dependentAssembly>
    <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
    <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="3.0.0.0" />
  </dependentAssembly>
  <dependentAssembly>
    <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
    <bindingRedirect oldVersion="1.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
  </dependentAssembly>
  <dependentAssembly>
    <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
    <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
  </dependentAssembly>
  <dependentAssembly>
    <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" />
    <bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" />
  </dependentAssembly>
  <dependentAssembly>
    <assemblyIdentity name="Antlr3.Runtime" publicKeyToken="eb42632606e9261f" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-3.5.0.2" newVersion="3.5.0.2" />
  </dependentAssembly>
</assemblyBinding>
于 2013-11-07T02:10:47.423 回答