HotTowel模板扩展,使用BreezeJs保存数据库更改的问题

时间:2013-12-15 17:42:50

标签: angularjs json.net breeze hottowel

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

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

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

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

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

    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上发布我的代码并从那里进行测试来找到解决方法。我仍然无法测试localy,它似乎确实是因为Telerik在GAC中安装了Newtonsoft dll。现在至少我的代码可以从服务器上运行,但是对于解决方案的任何建议,我都可以测试localy。

1 个答案:

答案 0 :(得分:0)

Telerik在您的应用中安装的Newtonsoft版本可能与最新VS2013安装的预期不一致。这发生了很多。 VS2013破坏了许多安装,你可能会落后于Telerik更新。我建议您与Telerik谈谈他们将G92的版本放入GAC ......如果这确实是问题。

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