sjh37 / EntityFramework-Reverse-POCO-Code-First-Generator

EntityFramework Reverse POCO Code First Generator - Beautifully generated code that is fully customisable. This generator creates code as if you reverse engineered a database and lovingly created the code by hand. It is free to academics (you need a .edu or a .ac email address), not free for commercial use. Obtain your licence from
https://www.reversepoco.co.uk/
Other
706 stars 230 forks source link

Bug in 3.8.0 with optionsBuilder.UseLazyLoadingProxies() #785

Closed nealculiner closed 1 year ago

nealculiner commented 1 year ago

I updated to 3.8.0 and I'm not on EF Core 7 yet, still using EF Core 6 per my .tt settings below. My solution is throwing an error now when building after this update:

    Settings.DatabaseType            = DatabaseType.SqlServer; // SqlServer, SqlCe, PostgreSQL. Coming next: MySql, Oracle
    Settings.TemplateType            = TemplateType.EfCore6; // EfCore7, EfCore6, EfCore5, EfCore3, EfCore2, Ef6, FileBasedCore2-7. FileBased specify folder using Settings.TemplateFolder
    Settings.GeneratorType           = GeneratorType.EfCore; // EfCore, Ef6, Custom. Custom edit GeneratorCustom class to provide your own implementation
    Settings.FileManagerType         = FileManagerType.EfCore; // .NET Core project = EfCore; .NET 4.x project = VisualStudio; No output (testing only) = Null

Error CS1061 'DbContextOptionsBuilder' does not contain a definition for 'UseLazyLoadingProxies' and no accessible extension method 'UseLazyLoadingProxies' accepting a first argument of type 'DbContextOptionsBuilder' could be found (are you missing a using directive or an assembly reference?)

nealculiner commented 1 year ago

As I realized I was using EF Core 7 I changed TemplateType to TemplateType.EfCore7 and still get the same error.

nealculiner commented 1 year ago

Just read release notes (of course, do this last):

Include call to .UseLazyLoadingProxies() if Settings.UseLazyLoading = true. Please install the Microsoft.EntityFrameworkCore.Proxies NuGet package.