Breeze服务器生成的Guid键将临时客户端密钥保存到数据库 [英] Breeze server-generated keys of guids saving temporary client keys to database

查看:89
本文介绍了Breeze服务器生成的Guid键将临时客户端密钥保存到数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经建立了一个微风应用程序,其实体设置为 Identity autoGeneratedKeyType 。我的数据库对主键使用 char(32)引导,该引导是在PK列上默认设置的,未设置为身份。

I have set up a breeze app with entities set to autoGeneratedKeyType of Identity. My database uses char(32) guids for primary keys, which are generated as defaults on the PK columns, which are NOT set as identities.

保存后,将在数据库中创建记录,但使用临时的微风生成键'undefined-1','undefined-2'等保存。

Upon save, the record gets created in the database, but it saves with the temporary breeze generated keys of 'undefined-1', 'undefined-2' etc.

微风可以处理这种类型的服务器端密钥生成方案吗?我有什么选择?由于现有系统的设计,我必须坚持使用这种密钥生成方法。想到在客户端上生成向导的想法……

Can breeze handle this type of server-side key generation scheme? What are my options? I must stick with this key generation approach due to the design of the existing system. Generating guids on the client comes to mind...

您有任何想法吗?

推荐答案

如果您正在使用Guid's,我认为最佳实践应该是在客户端上生成它们。您可以使用 breeze.core.getUuid()方法(当前未记录)来生成客户端Guid。

If you are working with Guid's, I think best practice should be to generate them on the client. You can use the breeze.core.getUuid() method ( currently undocumented) to generate client side Guid's.

如果您真的想在服务器上生成它们,则需要使用Breeze KeyGenerator。有关此主题的更多信息,请参见:在此页面内和内部搜索密钥生成器。 API文档。

If you really want to generate them on the server, then you will need to use a Breeze KeyGenerator. There is more information on this topic here: Search for Key Generator within this page and within the API docs.

这篇关于Breeze服务器生成的Guid键将临时客户端密钥保存到数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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