SQLite Constraint Violation
Posted: Wed 03 Apr 2013 14:42
Hey all, posting here, though this may not necessarily be a Devart dotConnect specific issue. I really have no idea what is causing this and I was hoping someone could help.
I have two models that 'sort-of' look like this:
public abstract class Root
{
public Guid ID {get;set;}
}
public class User : Root
{}
public class SomeObject : Root
{
public virtual User Owner {get;set;}
}
If I add a user to my database, save changes, create 'SomeObject' set the Owner to the User that I added, then add my new 'SomeObject' instance to the database, I get the following when calling SaveChanges:
SQLiteException
"Abort due to constraint violation column ID is not unique."
Is this due to the fact that I have an ID for my SomeObject instance, then an ID for my User instance that the SomeObject entity is trying to keep track of? Shouldn't this be handled for me?
Anyway, any help would be greatly appreciated.
I have two models that 'sort-of' look like this:
public abstract class Root
{
public Guid ID {get;set;}
}
public class User : Root
{}
public class SomeObject : Root
{
public virtual User Owner {get;set;}
}
If I add a user to my database, save changes, create 'SomeObject' set the Owner to the User that I added, then add my new 'SomeObject' instance to the database, I get the following when calling SaveChanges:
SQLiteException
"Abort due to constraint violation column ID is not unique."
Is this due to the fact that I have an ID for my SomeObject instance, then an ID for my User instance that the SomeObject entity is trying to keep track of? Shouldn't this be handled for me?
Anyway, any help would be greatly appreciated.