Base solution for your next web application
Open Closed

Loaz loading Entity Framework Core #11634


User avatar
0
kansoftware created

Hi, I was tried to use below code to enable lazy load.

protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
    optionsBuilder.UseLazyLoadingProxies();
}

For this i install the Microsoft.EntityFrameworkCore.Proxies NuGet package into your project. After this i am getting error in below image. I done project upgrade version 8 to 12.1.0 and then i instill this library

Markdown is supported
Copy & paste or drag & drop images (max 30 MB per image)

7 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team
    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    kansoftware created

    Hi,

    Could you try this solution ?

    https://github.com/aspnetboilerplate/aspnetboilerplate/issues/3882#issuecomment-564860867

    No, I tried on startup class in MVC project. in ConfigureServices function but getting same error

    See error

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    The default approach dodesn't work. Could you modify your code by following the link I have shared ?

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    kansoftware created

    Hi,

    The default approach dodesn't work. Could you modify your code by following the link I have shared ?

    Please guide me at which place i need to modify the code, In which file and project.

    I did not find class ServiceCollectionRegistrar

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Sorry, I think this class is defined in a different project. However, you can follow an approach as explained here https://aspnetzero.com/blog/persist-data-protection-keys-to-database.

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    kansoftware created

    Hi,

    Sorry, I think this class is defined in a different project. However, you can follow an approach as explained here https://aspnetzero.com/blog/persist-data-protection-keys-to-database.

    I think this is not relevant to lazy loading EF.

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    m.aliozkaya created
    Support Team

    Hi @kansoftware,

    The problem is related to the castle.core version. Abp supports to castle.core v4.4.1. Could you try again with Microsoft.EntityFrameworkCore.Proxies 6.* versions?

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)