Guid Key和StoreGeneratedPattern标识在ddl表定义中没有生成自动生成的guid? [英] Guid Key and StoreGeneratedPattern identity does not generated an auto generated guid in the ddl table definition ?

查看:96
本文介绍了Guid Key和StoreGeneratedPattern标识在ddl表定义中没有生成自动生成的guid?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨。

我正在使用EF4测试版,我一直在尝试添加一个带有Guid类型的关键字段Id的表。密钥应该由数据库服务器生成,因此我将StoreGeneratedPattern设置为identity。但是当我生成ddl sql文件时,关键字段没有生成newsequentialid。我错过了什么或是知道问题吗?

Hi.

I'm using EF4 beta and I've been trying to add a table with a key field Id of type Guid. The key should generated by the database server so I've set the StoreGeneratedPattern to identity. However when I generated the ddl sql file, the key field does not generated a newsequentialid.
Am i missing something or is it a know issue ?

推荐答案

标识声明不会影响uniqueidentifier字段,您需要数据库默认值NewId()。我们正在对设计人员的数据库生成电源组进行更新,这将允许您为每个属性指定数据库默认值。

因此,目前这是一个已知问题,解决方法是编辑生成的TSQL以添加NewId()默认值,或创建新的guid客户端。

HTH
  Noam
Identity declarations do not affect uniqueidentifier fields, for which you need a database default value of NewId(). We're working on an update to the designer's database generation power pack which will allow you to specify the database default for each property.

So, for now this is a known issue and the workaround is to either edit the generated TSQL to add the NewId() default, or to create a new guid client-side.

HTH
 Noam


这篇关于Guid Key和StoreGeneratedPattern标识在ddl表定义中没有生成自动生成的guid?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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