Nullable GUID

后端 未结 10 2222
北荒
北荒 2020-12-15 04:36

In my database, in one of the table I have a GUID column with allow nulls. I have a method with a Guid? parameter that inserts a new data row in the table. However when I s

10条回答
  •  悲哀的现实
    2020-12-15 05:03

    You have to cast null to a nullable Guid, this how it worked for me :

    myRecord.myGuidCol = (myGuid == null) ? (Guid?)null : myGuid.Value
    

提交回复
热议问题