Hello Le,
Thanks for providing this framework. I've downloaded the latest release and I'm using it as a starting point for a new project. I've been having an issue with not getting related entities to load properly. I looked in your Northwind app and I think I've identified the same issue in the test method DeepLoadProductWithSupplier(). In the test you look for the existence of product, but not for supplier. I added an assert for supplier and it failed. I'm pretty new to EF, so I'm not sure if I'm just missing something simple or if there's something deeper going on. Here's the updated test method:
Thanks for providing this framework. I've downloaded the latest release and I'm using it as a starting point for a new project. I've been having an issue with not getting related entities to load properly. I looked in your Northwind app and I think I've identified the same issue in the test method DeepLoadProductWithSupplier(). In the test you look for the existence of product, but not for supplier. I added an assert for supplier and it failed. I'm pretty new to EF, so I'm not sure if I'm just missing something simple or if there's something deeper going on. Here's the updated test method:
[TestMethod]
public void DeepLoadProductWithSupplier()
{
using (IDataContextAsync northwindFakeContext = new NorthwindFakeContext())
using (IUnitOfWork unitOfWork = new UnitOfWork(northwindFakeContext))
{
unitOfWork.Repository<Supplier>().Insert(new Supplier {SupplierID = 1, CompanyName = "Nokia", City = "Tampere", Country = "Finland", ContactName = "Stephen Elop", ContactTitle = "CEO"});
unitOfWork.Repository<Product>().Insert(new Product {ProductID = 2, Discontinued = true, ProductName = "Nokia Lumia 1520", SupplierID = 1, ObjectState = ObjectState.Added});
unitOfWork.SaveChanges();
var product = unitOfWork.Repository<Product>().Find(2);
var supplier = product.Supplier;
Assert.IsNotNull(product);
Assert.IsNotNull(supplier);
}
}
Thanks