简体   繁体   English

MS Dynamics CRM - 数据库GUID

[英]MS Dynamics CRM - database GUIDs

I was using the SDK for CRM, and printed out the PK on a bunch of instances of one of our entities. 我正在使用SDK for CRM,并在我们的一个实体的一堆实例上打印出PK。 I repeated it with the database's filtered views, and got the same answer: 我用数据库的过滤视图重复了它,得到了相同的答案:

1a6c691d-391a-de11-8b0e-0050568407cb
    bd7b0ff0-391a-de11-8b0e-0050568407cb
    ed272bfe-391a-de11-8b0e-0050568407cb
    ... and so on ...

These don't appear to be valid GUIDs. 这些似乎不是有效的GUID。 For one, they LOOK wrong - they're nearly identical, a property that GUIDs haven't had since the old version 1 & 2 GUIDs that were based on MAC addresses and clock time. 首先,他们看错了 - 它们几乎完全相同,这是自从旧版本1和2 GUID基于MAC地址和时钟时间以来GUID没有的属性。 Moreover, however, is the fact that a certain nibble in a GUID indicates the GUID's version - that nibble is incorrect here. 而且,事实上GUID中的某个半字节表示GUID的版本 - 这里的半字节不正确。 (First nibble of the third section, ie: 1a6c691d-391a-** d **e11-8b0e-0050568407cb) - valid values are 1-5) (Generate a GUID using MS's GUID Generator - that slot will always be 4. (At least for the version I have.)) (第三部分的第一个半字节,即:1a6c691d-391a - ** d ** e11-8b0e-0050568407cb) - 有效值为1-5)(使用MS的GUID生成器生成GUID - 该插槽将始终为4.(至少对于我的版本。))

Are these GUIDs, or just IDs, and how do I know? 这些GUID,还是ID,我怎么知道?

You are right that they are GUIDs and that they are sequential. 你是对的,他们是GUID,他们是顺序的。 These keys are not generated by CRM. 这些密钥不是由CRM生成的。 They are generated by SQL Server. 它们由SQL Server生成。

SQL Server has a GUID type called uniqueidentifier. SQL Server具有名为uniqueidentifier的GUID类型。 It can be configured as either NEWID() or NEWSEQUENTIALID(). 它可以配置为NEWID()或NEWSEQUENTIALID()。 NEWID() will generate a new GUID every time. NEWID()每次都会生成一个新的GUID。 NEWSEQUENTIALID() generates a GUID the first time and then sequentially increments it on subsequent database inserts. NEWSEQUENTIALID()首次生成GUID,然后在后续数据库插入时按顺序递增。

So you have discovered that Dynamics CRM is configured for NEWSEQUENTIALID(). 因此,您发现Dynamics CRM已配置为NEWSEQUENTIALID()。

More info about this is here: http://www.mssqltips.com/tip.asp?tip=1600 有关这方面的更多信息,请访问: http//www.mssqltips.com/tip.asp?提示= 1600

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM