LINQ2SQL beta: modify scheme in modeller, and autogen PK's

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for MySQL
Post Reply
[email protected]
Posts: 27
Joined: Mon 08 Sep 2008 16:37

LINQ2SQL beta: modify scheme in modeller, and autogen PK's

Post by [email protected] » Wed 08 Oct 2008 08:35

Hi,

I'm not sure if i should keep asking questions about a beta product, because most of my questions probably will explain themselves in the final release.

Nevertheless:

In the futue, will we be able to change the model in the schema modeller, and generate the datacontext afterwards ?

For example, i want certain primary keys (GUID) to auto-generate themselves on insert, but i don't know how to set that option.

I've tried to set isdbgenerated = false, hoping a key would be generated. but eventually that is no option because that modification would be gone when i regenerate the datacontext from reverse engineering.

somehow related topic about auto-increment: http://devart.com/forums/viewtopic.php?t=12769

Would it be an idea to start a seperate forum for LINQ 2 SQL ?

Regards,

Yuri.

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

Post by Shalex » Thu 09 Oct 2008 14:10

In the futue, will we be able to change the model in the schema modeller, and generate the datacontext afterwards ?
Please give us an example to clarify the question. Now you can edit the model in Schema Modeler (to add new classes and new properties to them, to edit the existing entries).
For example, i want certain primary keys (GUID) to auto-generate themselves on insert, but i don't know how to set that option.
Now you can set the "Auto Generated Value" and "Auto-Sync" properties in Schema Modeler. They allow you to organize the work with autoincrement columns in database. Do you want to generate GUIDs at the client side and transfer them to database afterwards?
Would it be an idea to start a seperate forum for LINQ 2 SQL ?
This is a good idea. We are considering the possibility of adding new branches at our forum.

[email protected]
Posts: 27
Joined: Mon 08 Sep 2008 16:37

Post by [email protected] » Fri 10 Oct 2008 08:29

Ok, it works. I thought that i was missing the 'generate' option in the schema modeller.

It doesn't really matter if the GUIDS are created clientside or database side, as long as it works it's fine with me.

Thank you very much.

[email protected]
Posts: 27
Joined: Mon 08 Sep 2008 16:37

Post by [email protected] » Fri 10 Oct 2008 12:36

Let me rephrase that:

Since mysql does not have a guid datatype, i think that when there is a varchar(36) primary key, where the "auto generated value" is set to true, the class should generate a GUID in the constructor to insert in the database.

Ofcourse this can be done manually with every new insert using guid.newguid().

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

Post by Shalex » Tue 14 Oct 2008 11:30

The "auto generated value" property in Schema Modeler is used for autoincrement columns and for columns whose value is generated in the "instead of insert" trigger. After the insert operation there will be refresh of the field - the obtained database value will be transferred to the program. If a new value is generated in a constructor, meaning of the "auto generated value" property will not correspond to its name.

Post Reply