Return GUID of value of primary key after server generates it

Discussion of open issues, suggestions and bugs regarding LinqConnect – Devart's LINQ to SQL compatible ORM
Post Reply
FlorianDahn
Posts: 3
Joined: Thu 06 Feb 2020 18:23

Return GUID of value of primary key after server generates it

Post by FlorianDahn » Thu 06 Feb 2020 18:42

Hey guys,

I'm new to this, but the hole framework is pretty awesome.
Working with the hole Linq to SQL stuff for years and you brought the updates I'm looking for so long.
So first huge props here.

Long story short:

I started with a new project, it is an .Net Core ASP.Net WebAPI which will access and store some stuff in a MS SQL Server.
I already google around and found this article which is quite old but nearly exactly what is happening here.
viewtopic.php?f=6&t=17002&p=53186

Im trying to insert a object into the DB. The DB is quite simple for now, some tables, the one im testing with has one Primary Key a GUID and some mandatory and optional fields. I tried to use the IdGenerate feature with GUID and then any of the sub options allowed. Autosync set to OnInsert.

Code: Select all

CREATE TABLE [dbo].[test_process] (
    [Id]           UNIQUEIDENTIFIER DEFAULT (newid()) NOT NULL,
    [operationKey] NVARCHAR (50)    NOT NULL,
    [created]      DATETIME         NOT NULL,
    [entity]       NVARCHAR (100)   NOT NULL,
    [ordertype]    NVARCHAR (50)    NOT NULL,
    [status]       NVARCHAR (50)    NOT NULL,
    [started]      DATETIME         NULL,
    [finished]     DATETIME         NULL,
    [canceled]     DATETIME         NULL,
    [failed]       DATETIME         NULL,
    [result]       NVARCHAR (50)    NULL,
    PRIMARY KEY CLUSTERED ([Id] ASC),
);

Im always receiving a exception "Operand type clash: uniqueidentifiert is incompatible with numeric", always sadly...

(Original in german: "Operandentypkollision: uniqueidentifier ist inkompatibel mit numeric")

I tried to put the default Value on DB site to "newid()" which works in the "original" Linq to SQL.
Submit works, the object gets pushed to the DB but the ID didn't get back. Did I missed something ?

I have some other projects working with mostly latest SQL Servers.

Hope you could bring some light into it.

Thanks !

Warm regards
Florian Dahn

PS: Im using LinqConnect 4.9.1878.0 (hopefully latest) and MS SQL Server 2017

Shalex
Site Admin
Posts: 9102
Joined: Thu 14 Aug 2008 12:44

Re: Return GUID of value of primary key after server generates it

Post by Shalex » Thu 13 Feb 2020 11:12

We have reproduced the issue and are investigating it. We will notify you about the result.

FlorianDahn
Posts: 3
Joined: Thu 06 Feb 2020 18:23

Re: Return GUID of value of primary key after server generates it

Post by FlorianDahn » Sun 23 Feb 2020 16:44

Edit: Nevermind, it works fine! Nuget doesnt updated correctly. It is fixed now, thanks !

Code: Select all

Hey, 

ok thanks for the note.
I have tried your last update, cause it sounds like you fixed. Sadly it isnt.

This is the version im using: 
Linqconnect: 4.9.1920.0
Entity Developer: 6.6.936

Thanks!

Warm regards
Florian

Shalex
Site Admin
Posts: 9102
Joined: Thu 14 Aug 2008 12:44

Re: Return GUID of value of primary key after server generates it

Post by Shalex » Mon 02 Mar 2020 16:33

The bug with returning the generated value for the property with Auto-Sync=OnInsert, which corresponds to non-Identity column, is fixed in v4.9.1920: viewtopic.php?f=31&t=39886.

FlorianDahn
Posts: 3
Joined: Thu 06 Feb 2020 18:23

Re: Return GUID of value of primary key after server generates it

Post by FlorianDahn » Tue 10 Mar 2020 19:46

Yes it is fixed! You could close this topic now. Thanks

Post Reply