I have this table:
create table dbo.NotificationsIn
(
NotificationID varchar(18) primary key,
ArrivalTime datetime not null default getdate()
)
I insert to it like this:
public void InsertNotification(NotificationsIn notification)
{
db.NotificationsIns.InsertOnSubmit(notification);
db.SubmitChanges();
}
where db is a LINQ DataContext.
I get the following exception after I insert a new record:
System.InvalidOperationException: Member AutoSync failure. For members to be Auto-Synced after insert, the type must either have an auto-generated identity, or a key that is not modified by the database after insert.
In the dbml, I have set the ArrivalTime property AutoGenerated = True and Auto-Sync = OnInsert. I have also tried Auto-Sync = Never, but the result is the same.
Any idea why I am getting this exception? Thank you.