【问题标题】:HotTowel Template extention, problems using BreezeJs to save changes on databaseHotTowel 模板扩展,使用 BreezeJs 保存数据库更改的问题
【发布时间】:2013-12-17 03:53:40
【问题描述】:

最近我开始使用 John Papa http://www.johnpapa.net/hot-towel-angular/ 提供的 HotTowel AngularJs BreezeJs 模板。

我遇到了一个我无法理解的错误:从服务器获取数据没有问题,但是当我尝试调用 saveChanges() 时,我收到以下错误:

“Message='Newtonsoft.Json.Linq.JObject' 不包含“实体”的定义”

我为这个问题找到的最接近的可能答案来自 :Exception when trying Breeze.js example in version 1.0.1 ,但我没有发现 Telerik Studio 安装在我的电脑上。我确实有很多其他 Telerik 产品,例如 Fiddle、JustCode 等。我确实在 GAC 中安装了 Newtonsoft dll。据我了解,在使用 BreezeJS 时可能会导致错误,我想知道处理这些错误的最佳方法是什么——我是从 GAC 卸载 dll,因此可能会破坏使用它的 Telerik 产品,还是有其他方法围绕它。

对于代码本身,我使用的是实体框架,使用 Code First 在 Windows Azure 上创建一个数据库。我已经按照 John Papa 的示例设置了一个存储库,并将它与 BreezeController 连接起来。正如我之前所说,所有的吸气剂都能完美地工作,但是当我尝试发布一些东西时,我得到了一个错误。您可以在下面找到完整的错误消息:

    Microsoft.CSharp.RuntimeBinder.RuntimeBinderException was unhandled by user code
    HResult=-2146233088
    Message='Newtonsoft.Json.Linq.JObject' does not contain a definition for 'entities'
    Source=Anonymously Hosted DynamicMethods Assembly
    StackTrace:
    at CallSite.Target(Closure , CallSite , Object )
    at System.Dynamic.UpdateDelegates.UpdateAndExecute1[T0,TRet](CallSite site,T0      arg0)
   at Breeze.ContextProvider.ContextProvider.SaveChanges(JObject saveBundle, TransactionSettings transactionSettings)
   at CC.Dal.StudentHubRepository.SaveChanges(JObject saveBundle) in c:\Users\Georgi\Documents\Visual Studio 2012\Projects\LearningAngular.web\CC.Dal\StudentHubRepository.cs:line 26
   at CC.Web.Controllers.BreezeController.SaveChanges(JObject saveBundle) in c:\Users\Georgi\Documents\Visual Studio 2012\Projects\LearningAngular.web\LearningAngular.web\Controllers\BreezeController.cs:line 27
   at lambda_method(Closure , Object , Object[] )
   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass10.<GetExecutor>b__9(Object instance, Object[] methodParameters)
   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.Execute(Object instance, Object[] arguments)
   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken)
  InnerException: 

提前感谢您提供的任何信息。作为 StackOverflow 几年来的日常用户,这是我实际发布的第一个问题,希望它表述得足够清楚。

编辑:我确实找到了一种解决方法,方法是每次在 windows azure 上发布我的代码并从那里进行测试。我仍然无法测试本地化,似乎确实是因为 Telerik 在 GAC 中安装了 Newtonsoft dll。现在至少我的代码可以在服务器上运行,但是任何关于解决方案的建议,以便我可以在本地进行测试,我们将不胜感激。

【问题讨论】:

    标签: angularjs json.net breeze hottowel


    【解决方案1】:

    您的应用中安装的 Telerik 版本的 Newtonsoft 可能与最新 VS2013 安装的预期不一致。这已经发生了很多。 VS2013 破坏了许多安装,您可能会落后于 Telerik 更新。我建议您与 Telerik 讨论他们正在加入 GAC 的 Newtonsoft 版本……如果这确实是问题所在。

    FWIW,应该没有这种性质的问题。您描述的堆栈已知可在 Azure 中工作。

    【讨论】:

    • 我正在使用 Visual Studio 2012 运行 SPA,最新的更新大大促进了这一点。我认为你是正确的,安装在 GAC 中的 Newtonsoft lirabriers 会出现某种类型的错误。当我将网站代码上传到 Azure 时,它​​运行良好。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-09-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-10-14
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多