【发布时间】: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