Navigation properties not set when using ADO.NET Mocking Context Generator
Posted
by
olenak
on Stack Overflow
See other posts from Stack Overflow
or by olenak
Published on 2011-12-01T01:28:23Z
Indexed on
2011/12/01
1:54 UTC
Read the original article
Hit count: 223
I am using ADO.NET Mocking Context Generator plugin for my Entity Framework model. I have not started on using mocks yet, just trying to fix generated entity and context classes to make application run as before without exceptions. I've already fixed T4 template to support SaveChanges method.
Now I've got another problem: when I try to access any navigation property it is set to null. All the primitive fields inherited from DB table are set and correct.
So what I am doing is the following
using (var context = MyContext())
{
var order = context.Orders.Where(p => p.Id == 7);
var product = order.Products;
}
in this case product is set to null. But that was not a case while using default code generator, it used to return real product object.
Thanks ahead for any suggestions!
© Stack Overflow or respective owner