AspNetCoreOData icon indicating copy to clipboard operation
AspNetCoreOData copied to clipboard

Possible to pre-compile EDM model?

Open Steve887 opened this issue 1 year ago • 1 comments

I'm trying to save some time on the first request of our app. Because our OData model is quite big, building the model takes several seconds on the first request.

Is it possible to pre-compile the model at design time and use this at runtime, much like how you can precompile an entity framework model?

Steve887 avatar Oct 25 '24 04:10 Steve887

Something tangentially related was discussed here:

  • https://github.com/OData/AspNetCoreOData/issues/896

Apparently the OP wanted something similar to what you need, which is basically to cache the EDM and load it quickly on startup. In his case, he saved it to XML and deserialized during startup, but there are some limitations with that approach as described in the issue.

Might still be useful for you to take a look.

Having a "first-class" way to pre-generate the EDM would be very beneficial though. Perhaps a source-generated EDM would be ideal.

The slowness of the EDM model build-up at startup has also been reported here before:

  • https://github.com/OData/AspNetCoreOData/issues/956

julealgon avatar Oct 25 '24 13:10 julealgon