diff options
| author | Bond-009 <bond.009@outlook.com> | 2020-07-23 10:30:45 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-07-23 10:30:45 +0200 |
| commit | 6b11cccb7fc0bb0320a4f4c4241e6509f2bfc716 (patch) | |
| tree | 139fae99c2fd7fb52cb05fa8b56925350706fd46 /Jellyfin.Server.Implementations/Users/UserManager.cs | |
| parent | 3a9698de549d7cb4eae71a8c54342babd1905dd3 (diff) | |
| parent | b4532ad3a2ea0066fa901bd46b6236aac46bceb7 (diff) | |
Merge pull request #3663 from crobibero/efcore-leak
Add missing usings to UserManager
Diffstat (limited to 'Jellyfin.Server.Implementations/Users/UserManager.cs')
| -rw-r--r-- | Jellyfin.Server.Implementations/Users/UserManager.cs | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/Jellyfin.Server.Implementations/Users/UserManager.cs b/Jellyfin.Server.Implementations/Users/UserManager.cs index 52e09a55a..c5c89d37d 100644 --- a/Jellyfin.Server.Implementations/Users/UserManager.cs +++ b/Jellyfin.Server.Implementations/Users/UserManager.cs @@ -102,7 +102,16 @@ namespace Jellyfin.Server.Implementations.Users } /// <inheritdoc/> - public IEnumerable<Guid> UsersIds => _dbProvider.CreateContext().Users.Select(u => u.Id); + public IEnumerable<Guid> UsersIds + { + get + { + using var dbContext = _dbProvider.CreateContext(); + return dbContext.Users + .Select(user => user.Id) + .ToList(); + } + } /// <inheritdoc/> public User? GetUserById(Guid id) @@ -637,7 +646,7 @@ namespace Jellyfin.Server.Implementations.Users /// <inheritdoc/> public void UpdateConfiguration(Guid userId, UserConfiguration config) { - var dbContext = _dbProvider.CreateContext(); + using var dbContext = _dbProvider.CreateContext(); var user = dbContext.Users .Include(u => u.Permissions) .Include(u => u.Preferences) @@ -670,7 +679,7 @@ namespace Jellyfin.Server.Implementations.Users /// <inheritdoc/> public void UpdatePolicy(Guid userId, UserPolicy policy) { - var dbContext = _dbProvider.CreateContext(); + using var dbContext = _dbProvider.CreateContext(); var user = dbContext.Users .Include(u => u.Permissions) .Include(u => u.Preferences) |
