将Breeze与EF一起使用时出错 [英] Errors when using Breeze with EF

查看:91
本文介绍了将Breeze与EF一起使用时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将breezejs与EF一起使用。我的Web API正在返回一个对象,该对象由许多我用来绑定到网格的链接实体的属性组成。稍后我将需要更新一些属性,并且想要缓存数据,因此轻而易举。我正在使用noDB示例创建自定义实体。

I am using breezejs with EF. My Web API is returning an "object" consisting of properties from a number of linked entities which I use to bind to a grid. I will need to update some of the properties later and I want to cache the data , hence breeze. I am using the noDB sample to create a custom Entity.

第一个问题是,微风似乎期望在addEntityType方法中传递名为name的属性,否则会引发错误。 structuralTypeName参数必须为字符串 '。

The first problem is that breeze seems to expect a property called name to be passed in the addEntityType method or it throws an error The 'structuralTypeName' parameter must be a 'string'.

第二个问题是对第4742行的微风中的structuralType._fixup的调用似乎抛出了以下错误。对象#没有方法 _fixup,尽管我可以看到函数存在。

The second problem is the call to structuralType._fixup in breeze on line 4742 seems to be throwing the following error Object # has no method '_fixup' though I can see the function exists.

有人能指出我在下面的代码中做错了什么吗?错误发生在addEntityType调用中。

Can anyone point out what I am doing wrong in the code below ? The error is in the addEntityType call.

manager.metadataStore.addEntityType({
            name: "Transcription", shortName: "Transcription", namespace: "Etrans.Data.Models", autoGeneratedKeyType: breeze.AutoGeneratedKeyType.Identity,
            dataProperties: {
                audio: { dataType: DataType.String }, clientID: { dataType: DataType.Int32 }, clientName: { dataType: DataType.String },
                clinicianfirstname: { dataType: DataType.String }, clinicianlastname: { dataType: DataType.String }, Notes: { dataType: DataType.String },
                status: { dataType: DataType.String }, transcriptionid: { dataType: DataType.Int32, isPartOfKey: true }, user: { dataType: DataType.String }
            }

        });
        manager.metadataStore.registerEntityTypeCtor("Transcription", null, customReportFields);

在服务器端,我在名为Etrans.Data的项目中拥有数据层。 Web API调用查询数据层的存储库。在这种情况下,它正在查询一个名为Transcription的实体(Etrans.Data.Models.Transcription)和许多链接的实体。

On the server side I have the data layer in a project called Etrans.Data. The web API invokes a repository which queries the data layer. In this instance it is querying an Entity called Transcription (Etrans.Data.Models.Transcription) and a number of linked entities.

推荐答案

@shai-很遗憾您遇到的困惑,这似乎是BreezeJS客户端元数据定义API演变的结果。但是我不完全理解您的建议。

@shai - I regret the confusion you encountered which appears to be a consequence of the evolution of the BreezeJS client metadata definition API. But I do not fully understand your recommendation.

HotTowel模板和HT NuGet包确实依赖于BreezeJS NuGet包的较旧版本,该版本可能具有 addEntityType 方法(我没看过)。我将与John Papa合作更新HT的内容。

The HotTowel template and HT NuGet package(s) do depend upon an older version of the BreezeJS NuGet package which may have had an addEntityType method that has since changed (I haven't looked). I'll work with John Papa to get the HT stuff updated.

但是我不明白您要告诉别人做什么。如果您处于HT模板当时官方能力的范围之内,它们将按交付方式工作。 FWIW,客户端元数据定义当时处于beta版本,我们说过它的API可能会更改。这项工作仍在进行中。

But I don't understand what you're telling people to do. The HT templates work as delivered if you stay within the boundaries of their then-official-capabilities. FWIW, client-side metadata definition was in beta at the time and we said that its API was likely to change. It is still a work in progress.

将应用程序更新到最新版本的依赖程序包当然会有所改变。这就是为什么要升级的原因。

Updating an app to the latest versions of dependent packages will change some things of course. That is why one would upgrade.

您是说在更新最新的Breeze NuGet软件包后仍然存在问题吗?您是否指出最新的Breeze NuGet软件包(我写的是1.3.3)与GitHub中的最新源代码之间存在差异。那里总是存在一些差异-GitHub上的BreezeJS始终持有我们的最新想法...许多想法都将发生变化,并且其中的任何一个都不能用于开发。我建议人们s 勾选官方发布的版本

Are you saying that there is a continuing problem after you update to the latest Breeze NuGet packages? Are you pointing to some discrepancy between the latest Breeze NuGet packages (1.3.3 as I write) and the latest source in GitHub. There is always some discrepancy there - BreezeJS on GitHub always holds our latest ideas ... many of which will change and none of them approved for development use. I would advise people to stick with official releases.

您是在告诉人们不应该使用HotTowel吗?为什么?您遇到的问题不是主流功能(甚至不是HT的正式功能)。

Are you telling folks they shouldn't use HotTowel? Why? The problem you encountered is not in a mainstream feature (it's not even an official feature of HT).

OTOH,我理解并完全同意将所有与HT相关的软件包(包括Durandal和Toastr以及Breeze)升级到最新版本的建议。

OTOH, I both understand and fully agree with the recommendation to upgrade all HT dependent packages (including Durandal and Toastr as well as Breeze) to latest versions.

感谢我们陪在我们那里。

Thanks for hanging in there with us.

这篇关于将Breeze与EF一起使用时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆