dotnet / Scaffolding

Code generators to speed up development.
MIT License
637 stars 228 forks source link

Update the Blazor CRUD scaffolder to use IDbContextFactory instead of injecting the DbContext directly in to components #2693

Open danroth27 opened 6 months ago

danroth27 commented 6 months ago

We've received feedback from users that the component code generated by the Blazor CRUD scaffolder should use the IDbContextFactory instead of injecting the DbContext directly to avoid making multiple overlapping queries with the same DbContext instance. With static server-side rendering this is less likely to happen, but we think it's best to make the change to be in line with our documented Blazor guidance.

deepchoudhery commented 3 months ago

addressed #2835, will be released for .NET 8 and .NET 9 Preview 6 next week!

thomasclaudiushuber commented 1 month ago

Just wanted to send some love here! ❤️

I'm working on a new Pluralsight course called "Building a Data-driven Blazor Server Application with EF Core" and while recording the demo of the scaffolder I just noticed that the generated code is using IDbContextFactory. That's fantastic! Thank you everyone!

I guess this issue can be closed.