question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Precompiling models and missing usings

See original GitHub issue

Hey 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:closed
  • Created 2 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
Enngagecommented, Sep 17, 2021

@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 the enums are not even used in generated models, and so the project builds ok.

0reactions
Enngagecommented, Sep 17, 2021

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to fix .pch file missing on build?
Right click to the project and select the property menu item · goto C/C++ -> Precompiled Headers · Select Not Using Precompiled Headers....
Read more >
Components missing in precompiled Xilinx libraries. #1466
After compiling ALL Xilinx libraries I discovered that a lot of in the XIlinx libraries available components are not compiled in the GHDL ......
Read more >
Macs with M1 chip are missing precompiled binaries ...
I am using Mac mini (with latest M1 Model) and all commands are run in Rosetta 2 terminal. When starting Beacon-chain node using...
Read more >
How to use precompiled WRF on Cheyenne
Hi, I'm new to Cheyenne and WRF. I copied the precompiled WRF ( (/glade/u/home/wrfhelp/PRE_COMPILED_CODE) ) to my own directory ...
Read more >
The Asset Pipeline
When using asset precompilation, you will need to ensure that your controller assets will be precompiled when loading them on a per page...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found