foreign key in sqlite in xamarin farms using SQLite-Net-PCL

Salman Paul 21 Reputation points
2020-06-29T12:02:51.127+00:00

I have tried to create the foreign key in sqlite in xamarin farms cross platform using SQLite-Net-PCL. But not created please help me fining the issue.

**

  • Users Table public class Users
    {
    [PrimaryKey]
    public int UserID { get; set; }
    public string UserName { get; set; }
    public string UserPassword { get; set; }
    
    [OneToMany]
    public List<AttendanceRecord> AttendanceRecords { get; set; }
    
    }
  • AttendanceRecord table

public class AttendanceRecord
{
[PrimaryKey, AutoIncrement]
public int ID { get; set; }
[ForeignKey(typeof(Users))]
public int UserID { get; set; }
public DateTime InDate { get; set; }
public double InLatitude { get; set; }
public double InLongitude { get; set; }
public DateTime OutDate { get; set; }
public double OutLatitude { get; set; }
public double OutLongitude { get; set; }
public bool IsIsSynchronize { get; set;}

}

**

Please guide me whats wrong i am doing when i check my Sqlite db in my DB Browser for Sqlite. Relation not created.

Not Monitored
Not Monitored
Tag not monitored by Microsoft.
37,610 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Anonymous
    2020-06-29T12:15:39.607+00:00

    Xamarin is not currently supported here on QnA. They're actively answering questions in dedicated forums here.
    https://forums.xamarin.com/

    --please don't forget to Accept as answer if the reply is helpful--


    Regards, Dave Patrick ....
    Microsoft Certified Professional
    Microsoft MVP [Windows Server] Datacenter Management

    Disclaimer: This posting is provided "AS IS" with no warranties or guarantees, and confers no rights.

    0 comments No comments