简体   繁体   English

Telerik OpenAccess GUID被清空

[英]Telerik OpenAccess GUID is blanked off

I am trying to add a relatively simple entity via Telerik.OpenAccess . 我试图通过Telerik.OpenAccess添加一个相对简单的实体。

One property of this entity is a GUID set via c#'s GUID.NewGuid() . 该实体的一个属性是通过c#的GUID.NewGuid()设置的GUID。

The property is set fine right before the call to SaveChanges() but then looking in SQL Profiler the value is all 0's. 该属性在调用SaveChanges()之前设置良好,但随后在SQL事件探查器中查找的值全为0。

Anyone experienced this? 有人经历过吗? Couldn't find any advice here or on Telerik's forums and am not sure how to progress. 在这里或Telerik的论坛上找不到任何建议,并且不确定如何取得进展。

I suppose that the GUID column is an identity column of your table and the Telerik OpenAccess ORM is configured to leave the SQL Server populating the identity column value. 我假设GUID列是表的标识列,并且Telerik OpenAccess ORM配置为让SQL Server填充标识列值。

In order to change this configuration you could select the problematic class in the Visual Designer , press F4 to open its properties window and set its Identity Mechanism to Default . 为了更改此配置,您可以在Visual Designer中选择有问题的类,按F4打开其属性窗口,并将其标识机制设置为Default Most probably it is currently set to DatabaseServerCalculated as a default one using the database first scenario: 当前最有可能使用数据库优先方案将其设置为DatabaseServerCalculated作为默认值:

在此处输入图片说明

In this way OpenAccess ORM will respect the given value before calling the SaveChanges method instead of waiting for the Server to populate the column. 这样,OpenAccess ORM将在调用SaveChanges方法之前遵守给定的值,而不是等待服务器填充该列。

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

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