Skip to content

Commit 780acd5

Browse files
Removed unnecessary generic type parameters for the internal InMemoryCache class
1 parent ac2a4e6 commit 780acd5

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/DotNetToolkit.Repository.InMemory/InMemoryRepositoryBase.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ protected virtual void Dispose(bool disposing)
9595
internal void EnsureDeleted()
9696
{
9797
_items.Clear();
98-
InMemoryCache<TEntity, TKey>.Instance.GetContext(DatabaseName).Clear();
98+
InMemoryCache.Instance.GetContext(DatabaseName).Clear();
9999
}
100100

101101
#endregion
@@ -231,7 +231,7 @@ protected override void SaveChanges()
231231
{
232232
lock (_syncRoot)
233233
{
234-
var context = InMemoryCache<TEntity, TKey>.Instance.GetContext(DatabaseName);
234+
var context = InMemoryCache.Instance.GetContext(DatabaseName);
235235

236236
foreach (var entitySet in _items.Select(y => y.Value))
237237
{
@@ -273,7 +273,7 @@ protected override void SaveChanges()
273273
/// </summary>
274274
protected override IQueryable<TEntity> GetQuery(IFetchStrategy<TEntity> fetchStrategy = null)
275275
{
276-
return InMemoryCache<TEntity, TKey>.Instance
276+
return InMemoryCache.Instance
277277
.GetContext(DatabaseName)
278278
.Select(y => y.Value)
279279
.AsQueryable();
@@ -284,7 +284,7 @@ protected override IQueryable<TEntity> GetQuery(IFetchStrategy<TEntity> fetchStr
284284
/// </summary>
285285
protected override TEntity GetEntity(TKey key, IFetchStrategy<TEntity> fetchStrategy)
286286
{
287-
InMemoryCache<TEntity, TKey>.Instance
287+
InMemoryCache.Instance
288288
.GetContext(DatabaseName)
289289
.TryGetValue(key, out TEntity entity);
290290

@@ -358,17 +358,17 @@ private enum EntityState
358358

359359
#endregion
360360

361-
#region Nested type: InMemoryCache<TEntity, TKey>
361+
#region Nested type: InMemoryCache
362362

363363
/// <summary>
364364
/// Represents an internal thread safe database storage which will store any information for the in-memory
365365
/// store that is needed through the life time of the application.
366366
/// </summary>
367-
private class InMemoryCache<TEntity, TKey> where TEntity : class
367+
private class InMemoryCache
368368
{
369369
#region Fields
370370

371-
private static volatile InMemoryCache<TEntity, TKey> _instance;
371+
private static volatile InMemoryCache _instance;
372372
private static readonly object _syncRoot = new object();
373373
private readonly ConcurrentDictionary<string, SortedDictionary<TKey, TEntity>> _storage;
374374

@@ -377,7 +377,7 @@ private class InMemoryCache<TEntity, TKey> where TEntity : class
377377
#region Constructors
378378

379379
/// <summary>
380-
/// Prevents a default instance of the <see cref="InMemoryCache{TEntity, TKey}"/> class from being created.
380+
/// Prevents a default instance of the <see cref="InMemoryCache"/> class from being created.
381381
/// </summary>
382382
private InMemoryCache()
383383
{
@@ -391,7 +391,7 @@ private InMemoryCache()
391391
/// <summary>
392392
/// Gets the instance.
393393
/// </summary>
394-
public static InMemoryCache<TEntity, TKey> Instance
394+
public static InMemoryCache Instance
395395
{
396396
get
397397
{
@@ -400,7 +400,7 @@ public static InMemoryCache<TEntity, TKey> Instance
400400
lock (_syncRoot)
401401
{
402402
if (_instance == null)
403-
_instance = new InMemoryCache<TEntity, TKey>();
403+
_instance = new InMemoryCache();
404404
}
405405
}
406406

0 commit comments

Comments
 (0)