0

We are converting our data class library from .Net Framework to .Net Standard 2.0 so we can continue to use it in our old Framework projects but also utilize it in our new .Net Core projects.

Things are generally working well, but it does not use the Lazy Loading on which we depended in the Framework project, e.g. when I load an EmployeeIndexItem with an IndexItem, it does not get the Index Item:

[Table( "EmployeeIndexItem", Schema = "Core" )]
    public class EmployeeIndexItem
    {
        public Guid EmployeeIndexItemId { get; set; } = Guid.NewGuid();

        public int EmployeeId { get; set; }
        public Guid IndexItemId { get; set; }
        public virtual IndexItem IndexItem { get; set; }
    }

I have found the EntityFrameworkCore.Proxies documentation, but "Package Microsoft.EntityFrameworkCore.Proxies 6.0.4 is not compatible with netstandard2.0"

Is there a way to get the Lazy Loading to work in NetStandard? Or should I bite the bullet and do the necessary Includes?

Mike
  • 629
  • 5
  • 18
  • 1
    You must take the package that's compatible with your EF version. – Gert Arnold May 04 '22 at 15:37
  • @GertArnold - to which package are you referring? EntityFrameworkCore.Proxies? I see there is an Arch.EntityFrameworkCore (https://www.nuget.org/packages/Arch.EntityFrameworkCore/2.1.15) but they seem very shady. – Mike May 04 '22 at 20:17
  • Well, which EF version do you have? – Gert Arnold May 05 '22 at 06:44
  • have you checked this link yet https://stackoverflow.com/questions/40122162/entity-framework-core-lazy-loading – bachu noyan May 05 '22 at 10:03
  • @GertArnold - thank you! If you want to submit an answer I will select it. I did not realize that we were using the 3.1 version of EFCore, and thus could use the matching version of EFCore.Proxies. Thank you!! – Mike May 05 '22 at 17:50

0 Answers0