Next bug in your Product

Discussion of open issues, suggestions and bugs regarding LinqConnect – Devart's LINQ to SQL compatible ORM
Post Reply
Zero-G.
Posts: 398
Joined: Sat 09 Dec 2006 12:20

Next bug in your Product

Post by Zero-G. » Fri 12 Jun 2015 15:51

Hey

Using Linq with Ms SQL.
I do have a table, with it's
ID as uniqueidentifier and a column called row_version which is TimeStamp.
The id field is set to EntityKey and the field row_version is set to isVersion=true

Creation:

Code: Select all

CREATE TABLE dbo.bezart (
   id UNIQUEIDENTIFIER NOT NULL DEFAULT ('newsequentialid()'),
   text NVARCHAR(50) DEFAULT '',
   rechnungstext NVARCHAR(256) DEFAULT '',
   sofort BIT,
   [_rowVersion] TIMESTAMP NOT NULL,
   geloescht BIT NOT NULL DEFAULT 1,
   CONSTRAINT PK_bezart PRIMARY KEY (id)
)
When I try to make an insert:

Code: Select all

                locDestinationDataContext.Bezarts.InsertOnSubmit(New Destination.DestinationContext.Bezart With {.Geloescht = False, _
                                                                                                                 .ID = Guid.NewGuid, _
                                                                                                                 .Text = "Bar", _
                                                                                                                 .Sofort = True, _
                                                                                                                 .Rechnungstext = "Betrag dankend in bar erhalten"})
And then call a submitchange, than this creates following SQL Code:

Code: Select all

INSERT INTO dbo.bezart (text, rechnungstext, sofort, geloescht) VALUES (@p1, @p2, @p3, @p4);
SELECT id, [_rowVersion] FROM dbo.bezart WHERE id = SCOPE_IDENTITY();

-- p1: Input NVarChar (Size = 3; DbType = String) [Bar]
-- p2: Input NVarChar (Size = 30; DbType = String) [Betrag dankend in bar erhalten]
-- p3: Input Bit (Size = 0; DbType = Boolean) [True]
-- p4: Input Bit (Size = 0; DbType = Boolean) [False]
-- key1: Input UniqueIdentifier (Size = 0; DbType = Guid) [f27a74c8-3f5f-47c9-b783-ef32d186bde1]
-- Context: Devart.Data.SqlServer.Linq.Provider.SqlDataProvider Mapping: AttributeMappingSource Build: 4.4.735.0
But this can't work, because Scope_Identity is only valid in numeric fields and not in GUID fields.

PLEASE HELP - THX

MariiaI
Devart Team
Posts: 1472
Joined: Mon 13 Feb 2012 08:17

Re: Next bug in your Product

Post by MariiaI » Mon 15 Jun 2015 12:42

Please try setting the IdGenerator property of the ID entity property to Guid:
- right-click the corresponding entity property and select Properties;
- set IdGenerator to Guid and save the changes.

For some useful information, please refer to https://www.devart.com/linqconnect/docs ... ation.html.
Please tell us if this helps.

Zero-G.
Posts: 398
Joined: Sat 09 Dec 2006 12:20

Re: Next bug in your Product

Post by Zero-G. » Mon 15 Jun 2015 12:53

I tried it - but without success

Here is the generated code, when the IdGenerator is set to guid:

Code: Select all

INSERT INTO dbo.bezart (id, text, rechnungstext, sofort, geloescht) VALUES (@p1, @p2, @p3, @p4, @p5);
SELECT id, [_rowVersion] FROM dbo.bezart WHERE id = SCOPE_IDENTITY();

-- p1: Input UniqueIdentifier (Size = 0; DbType = Guid) [f3f726b1-6e3f-472e-841a-47406347832e]
-- p2: Input NVarChar (Size = 3; DbType = String) [Bar]
-- p3: Input NVarChar (Size = 30; DbType = String) [Betrag dankend in bar erhalten]
-- p4: Input Bit (Size = 0; DbType = Boolean) [True]
-- p5: Input Bit (Size = 0; DbType = Boolean) [False]
-- key1: Input UniqueIdentifier (Size = 0; DbType = Guid) [f3f726b1-6e3f-472e-841a-47406347832e]
-- Context: Devart.Data.SqlServer.Linq.Provider.SqlDataProvider Mapping: AttributeMappingSource Build: 4.4.735.0

It changes, that Id is accepted as Input (what isn't without IdGenerator

MariiaI
Devart Team
Posts: 1472
Joined: Mon 13 Feb 2012 08:17

Re: Next bug in your Product

Post by MariiaI » Tue 16 Jun 2015 10:29

Thank you for the response. Set the Auto-Sync property of the ID entity property to Never. For example, the issue is not reproducible in our environment in this case.
We will also investigate this behaviour more clearly and contact you if any results are available.

Zero-G.
Posts: 398
Joined: Sat 09 Dec 2006 12:20

Re: Next bug in your Product

Post by Zero-G. » Tue 16 Jun 2015 15:40

Hey
This isn't really satisfiying...
Because, I have to calculate id id field on the Client / or requery the database to get the correct Id.

I hope you will implement some easy Transformation like the Output clause.
Take a look here: http://www.tech-recipes.com/rx/47032/a- ... ql-server/

THX

MariiaI
Devart Team
Posts: 1472
Joined: Mon 13 Feb 2012 08:17

Re: Next bug in your Product

Post by MariiaI » Thu 18 Jun 2015 07:02

Probably, we didn't understand each other correctly. Please see a small test project in the attachment to the letter, which we have sent you to the e-mail address you have provided in your forum profile.
Nevertheless, we will investigate this behaviour and notify you about the results as soon as possible.

Zero-G.
Posts: 398
Joined: Sat 09 Dec 2006 12:20

Re: Next bug in your Product

Post by Zero-G. » Fri 19 Jun 2015 13:21

Hey
THX - now I got it. - But there is one more Thing:
Now get for all my tables the following warning:
Warnung 1 Custom tool error: The AutoSync attribute of the property 'ID' in the class 'Aerzte' needs to be 'OnInsert' when IsDbGenerated and IsPrimaryKey are 'True'. C:\Users\Harald\documents\visual studio 2013\Projects\VisualOptStudio\Convert\Destination\DestinationContext.lqml 1 1

I could say, that the IsDbGenerated = False, but this isn't the truth. - So, please Change the behaivor, for the warning, when a IdGenerator is set, that this warning isn't displayed any more.
THX

MariiaI
Devart Team
Posts: 1472
Joined: Mon 13 Feb 2012 08:17

Re: Next bug in your Product

Post by MariiaI » Mon 22 Jun 2015 12:29

Thank you for the response. We will inform you when any results regarding this behaviour are available.

MariiaI
Devart Team
Posts: 1472
Joined: Mon 13 Feb 2012 08:17

Re: Next bug in your Product

Post by MariiaI » Fri 03 Jul 2015 06:20

The support for columns with the 'uniqueidentifier DEFAULT NEWSEQUENTIALID()' data type is added.
Please try new build of LinqConnect 4.4.785.
It can be downloaded from http://www.devart.com/linqconnect/download.html (trial version) or from Registered Users' Area (for users with active subscription only).
For more information, please refer to http://forums.devart.com/viewtopic.php?f=31&t=32066.

Post Reply