data context object changes not being saved SQLlite

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for SQLite
Post Reply
SubtleTechnology
Posts: 1
Joined: Tue 22 Sep 2015 22:04

data context object changes not being saved SQLlite

Post by SubtleTechnology » Tue 22 Sep 2015 22:50

We added a LinqConnec to SQLlite diagram, and using the datacontext everything loads fine but making changes to any of the objects does not save. GetChangeSet() returns no records to be updated either.

We get the list similar to this (this is not the actual code just typed by hand example):

using(var db = ItemsDataContext(connectionString))
{
db.ObjectTrackingEnabled = true;
var item = db.Items.FirstOrDefault();
item.Enabled = true;
var cs = db.GetChangeSet();
db.SubmitChanges();
db.Refresh(Devart.Data.Linq.RefreshMode.OverwriteCurrentValues, item); // throws exception saying detached object
}

if I do:
db.Refresh(Devart.Data.Linq.RefreshMode.OverwriteCurrentValues, item);
it throws an exception saying that "Can't update a detached object"

So why are they detached?

var t = db.GetTable<ItemDataContext.Items>();

it says t.IsReadOnly is true?

My connection string is simply "Data Source=ItemData.sqlite"

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

Re: data context object changes not being saved SQLlite

Post by MariiaI » Wed 23 Sep 2015 11:38

We have contacted you by e-mail.

Post Reply