public void DbRefIndexe_Test() { var f = ""; f = @"C:\Git\LiteDB\LiteDB.Shell\bin\Debug\_dbref.db"; File.Delete(f); using (var db = new DbRefIndexDatabase(f)) { var customer = new DCustomer { Login = "******", Name = "John Doe" }; var order = new DOrder { OrderNumber = 1, Customer = customer }; db.Customers.Insert(customer); db.Orders.Insert(order); // create an index in Customer.Id ref db.Orders.EnsureIndex(x => x.Customer.Login); var query = db.Orders .Include(x => x.Customer) .FindOne(x => x.Customer.Login == "jd"); Assert.AreEqual(customer.Name, query.Customer.Name); } }
public void DbRefIndexe_Test() { using (var db = new DbRefIndexDatabase()) { var customer = new DCustomer { Login = "******", Name = "John Doe" }; var order = new DOrder { OrderNumber = 1, Customer = customer }; db.Customers.Insert(customer); db.Orders.Insert(order); // create an index in Customer.Id ref db.Orders.EnsureIndex(x => x.Customer.Login); var query = db.Orders .Include(x => x.Customer) .FindOne(x => x.Customer.Login == "jd"); Assert.AreEqual(customer.Name, query.Customer.Name); } }