How to use DbRef in LiteDB. I have classes for both Customer
and Job
. I want the Customer to store a list of jobs that the Customer has.
So in the Customer class, I need to have aDbRef<Job> Jobs
from what I understand. I have several issues. First, DbRef is not recognized as a type with using LiteDB
. Second, I have no idea how to implement it
Job.cs
namespace HMDCompare.Classes
{
public class Job
{
public int id { get; set; }
public string name { get; set; }
}
}
Customer.cs
using LiteDB;
namespace HMDCompare.Classes
{
public class Customer
{
[BsonId]
public int Id { get; set; }
public string Name { get; set; }
public string[] Phones { get; set; }
public bool IsActive { get; set; }
public DbRef<Job> Jobs { get; set; }
}
}
for the DbRef I get in Visual Studio: The type or Namespace name 'DbRef' could not be found.
I am developing in C#/ASP.net 4.5 and with LiteDB 2.0.0-rc