Lazy loading with EFCore 2.1

Thanks again @JoeAlbahari for fixing the EFCore 2.1 driver so quickly. I wonder if there is a way to avoid showing all the related entities as null (and make them navigable, obviously)? Need to have .Include() for all the related entities kind of kills the joy of having a way to quickly run LINQ queries :(

Comments

  • Good call - lazy loading is now supported in EF Core, so it should be enabled in LINQPad. I've now updated the driver to make this work. Be sure to enable lazy loading in your DbContext:

    https://docs.microsoft.com/en-us/ef/core/querying/related-data

    If you want lazy loading to be enabled only when used from LINQPad, put the following code into your OnConfiguring method:
    if (AppDomain.CurrentDomain.FriendlyName.StartsWith ("LINQPad"))
       optionsBuilder.UseLazyLoadingProxies ();
  • edited July 17
    After enabling lazy loading: image
  • I should have mentioned, you will need to update to the latest LINQPad beta.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!