Monday, December 31, 2018

How do the getsetters for a lazy loaded field get populated in Entity Framework 6's code first approach?

Well, instead of there being a getsetter there will be two fields like so:

private readonly Lazy<ICollection<Worker>> _workers;
public ICollection<Worker> Workers => _workers.Value;

 
 

When you stop at a breakpoint and inspect whatever has the Workers in Visual Studio 2017, you may, very likely, not see the Workers until you click on them (their variable title) there in the records list (coming off of you mousing over a variable in Visual Studio) to hydrate them.

No comments:

Post a Comment