Precompiling models and missing usings
See original GitHub issueHey everyone,
I’m attempting to generate precompiled models with:
optimize-DbContext -Context AppDbContext -OutputDir EFPrecompiledModels
which is working fine in itself, but the problem I have is that the generator does not add usings
if my model references some stuff from other projects within the solution. I have to manually go and add these usings myself.
Is there some setting I’m missing or is this perhaps something that was not yet implemented?
Additionally, it would be nice if there was an option to mark the class extending RuntimeModel
public - I have migrations & EF models in a separate project, and so if I generate models here, I have to manually add public
accessor to the class so I can use it in Startup
configuration.
Thanks!
Include provider and version information
EF Core version: 6.0.0-preview.7.21378.4 Database provider: Microsoft.EntityFrameworkCore.SqlServer Target framework: .NET6 Operating system: Win IDE: VS 2022
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (2 by maintainers)
@AndriySvyryd, thanks for getting back to me & adding the
public
accessor.I’ve updated our project to
.NET 6 RC1
and for whatever reason it all works fine. It seems that theenums
are not even used in generated models, and so the project builds ok.I suspect this might have been a problem with previous version of VS because multiple usings were broken just by updating VS and making no code changes.