loic-sharma / BaGet

A lightweight NuGet and symbol server
https://loic-sharma.github.io/BaGet/
MIT License
2.58k stars 644 forks source link

Use Entity Framework 7's bulk update for package downloads #718

Open loic-sharma opened 2 years ago

loic-sharma commented 2 years ago

Is your feature request related to a problem? Please describe.

Currently BaGet loads the package model to update its download count. This approach has a few flaws:

Describe the solution you'd like

When we update to EF7, use bulk updates: https://github.com/dotnet/efcore/issues/795

This lets us express a query like

UPDATE downloads = downloads + 1
FROM packages
WHERE id = 'newtonsoft.json' AND version = '1.0.0'