Linq Beta and AutoIncrement fields
Posted: Thu 28 Aug 2008 20:32
Hi all
I am experimenting with Linq and the Schema Modeller. I have a database id field that is an AutoIncrement field.
I can successfully insert a new row with linq, but the object is not updated with the id.
Example:
In the Schema Modeller these attributes are set:
Access: Public
Delay Loaded: False
Inheritance Modifier: None
Name: client_id
Type: System.Int64
Auto Generated Value: True
Auto-Sync: OnInsert
Is Version: False
Nullable: False
Primary Key: True
Read Only: False
Server Data Type: int(10) Not Null Auto_increment
Source: client_id
Update Check: Always
Any ideas on why the id field is not synced on my object after the submit?
Thanks!
Andrew
[/code]
I am experimenting with Linq and the Schema Modeller. I have a database id field that is an AutoIncrement field.
I can successfully insert a new row with linq, but the object is not updated with the id.
Example:
Code: Select all
client c = new client { client_name = clRow["name"].ToString() };
//client has an auto increment field called client_id
db.clients.InsertOnSubmit(c);
db.SubmitChanges();
Console.Write("client_id = " + c.client_id); //client_id is 0
In the Schema Modeller these attributes are set:
Access: Public
Delay Loaded: False
Inheritance Modifier: None
Name: client_id
Type: System.Int64
Auto Generated Value: True
Auto-Sync: OnInsert
Is Version: False
Nullable: False
Primary Key: True
Read Only: False
Server Data Type: int(10) Not Null Auto_increment
Source: client_id
Update Check: Always
Any ideas on why the id field is not synced on my object after the submit?
Thanks!
Andrew
[/code]