HotTowel EF6 MVC5 Angular Breeze版挑战

时间:2013-11-06 00:18:02

标签: entity-framework breeze asp.net-mvc-5 entity-framework-6 hottowel

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

我们的DataAccess Layer已升级为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 有一个微风更新可用。但是如何解决HotTowel

安装失败。滚回来... install-package:将“Microsoft.AspNet.WebApi.OData 5.0.0”更新为“Microsoft.AspNet.WebApi.OData 4.0.30506”失败。无法找到与之兼容的'Breeze.Server.WebApi2'版本 'Microsoft.AspNet.WebApi.OData 4.0.30506'。

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

2 个答案:

答案 0 :(得分:6)

Web APi v2出现时(与我的课程同一周)有一个不合理的结果。它现在已经解决,所以只需安装

即可
Install-Package HotTowel.Angular.Breeze -pre

答案 1 :(得分:4)

John Papas的QUICK版本回答 是的我需要HOtTowel的预备版本,更多的是angularJS Pre版本。 但这并没有解决所有问题。 我需要为ef6和WEB.CONFIG条目提供breeze包。

  

Install-Package HotTowel.Angular.Breeze -pre

我也必须使用 安装包Breeze.WebApi2.EF6

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

详细说明帮助它运行的内容。大约12小时后...以防有人遇到问题: 我会把它描述为ef6,MVC5,Razor,Hottowel,AngularJs Breeze Knockout组合 包COMBINATION

<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>