Skip to content

Commit

Permalink
upgrade dependencies & cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
dj-nitehawk committed Mar 1, 2024
1 parent 875285c commit ba83406
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 21 deletions.
4 changes: 2 additions & 2 deletions Benchmark/Benchmark.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="BenchmarkDotNet" Version="0.13.11"/>
<PackageReference Include="MongoDB.Driver.GridFS" Version="2.23.0"/>
<PackageReference Include="BenchmarkDotNet" Version="0.13.12"/>
<PackageReference Include="MongoDB.Driver.GridFS" Version="2.24.0"/>
</ItemGroup>

<ItemGroup>
Expand Down
17 changes: 6 additions & 11 deletions MongoDB.Entities/DB/DB.Watcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,19 @@ namespace MongoDB.Entities;
public static partial class DB
{
/// <summary>
/// Retrieves the 'change-stream' watcher instance for a given unique name.
/// If an instance for the name does not exist, it will return a new instance.
/// Retrieves the 'change-stream' watcher instance for a given unique name.
/// If an instance for the name does not exist, it will return a new instance.
/// If an instance already exists, that instance will be returned.
/// </summary>
/// <typeparam name="T">The entity type to get a watcher for</typeparam>
/// <param name="name">A unique name for the watcher of this entity type. Names can be duplicate among different entity types.</param>
public static Watcher<T> Watcher<T>(string name) where T : IEntity
{
// Normalize the name once
var normalizedName = name.ToLower().Trim();

// Use GetOrAdd to ensure thread-safe retrieval or addition of the watcher.
return Cache<T>.Watchers.GetOrAdd(normalizedName, newName => new Watcher<T>(newName));
}
=> Cache<T>.Watchers.GetOrAdd(name.ToLower().Trim(), newName => new(newName));

/// <summary>
/// Returns all the watchers for a given entity type
/// </summary>
/// <typeparam name="T">The entity type to get the watcher of</typeparam>
public static IEnumerable<Watcher<T>> Watchers<T>() where T : IEntity => Cache<T>.Watchers.Values;
}
public static IEnumerable<Watcher<T>> Watchers<T>() where T : IEntity
=> Cache<T>.Watchers.Values;
}
4 changes: 2 additions & 2 deletions MongoDB.Entities/MongoDB.Entities.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>

<Version>23.0.1</Version>
<Version>23.1.0</Version>

<TargetFramework>netstandard2.1</TargetFramework>
<RootNamespace>MongoDB.Entities</RootNamespace>
Expand Down Expand Up @@ -31,7 +31,7 @@

<ItemGroup>
<PackageReference Include="Microsoft.CSharp" Version="4.7.0"/>
<PackageReference Include="MongoDB.Driver" Version="2.23.0"/>
<PackageReference Include="MongoDB.Driver" Version="2.24.0"/>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All"/>
</ItemGroup>

Expand Down
10 changes: 5 additions & 5 deletions Tests/Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Medo.Uuid7" Version="1.8.2"/>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0"/>
<PackageReference Include="MSTest.TestAdapter" Version="3.1.1"/>
<PackageReference Include="MSTest.TestFramework" Version="3.1.1"/>
<PackageReference Include="coverlet.collector" Version="6.0.0">
<PackageReference Include="Medo.Uuid7" Version="1.9.1"/>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0"/>
<PackageReference Include="MSTest.TestAdapter" Version="3.2.2"/>
<PackageReference Include="MSTest.TestFramework" Version="3.2.2"/>
<PackageReference Include="coverlet.collector" Version="6.0.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
3 changes: 2 additions & 1 deletion changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

### IMPROVEMENTS

- upgrade mongodb driver to v2.23
- upgrade mongodb driver to v2.24
- minor internal refactors

[//]: # (### BREAKING CHANGES)

0 comments on commit ba83406

Please sign in to comment.