I have very simple relationship, my model looks like this:
public class Project
{
[PrimaryKey, AutoIncrement]
public int ID { get; set; }
public string Name { get; set; }
[ForeignKey(typeof(User))]
public int ProjectManagerID { get; set; }
[ManyToOne]
public User ProjectManager { get; set; }
}
public class User
{
public string Login { get; set; }
[OneToMany]
public List<Project> Projects { get; set; }
}
The problem is that I can easly save project, with its reference to user without saving user, and I don't get any constraint violation exception.
database.Insert(new Project
{
Name = "aaa",
ProjectManagerID = 8
});
I can even query my project, with invalid user id, but I don't have any record in User table stored. Another interesting thing is that I cannot store row like the one above in my SQLite management tool when I open this database, so I am sure my database schema is ok.
Is this normal in sqlite-net PCL library with sqlite-net-extensions?
UPDATE: My sqlite version is 3.8.7.4