forked from ddrilling/AsbCloudServer
CachedTable implement IEnumerable
This commit is contained in:
parent
9d80c28c1b
commit
3c9718b0de
@ -7,7 +7,8 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace AsbCloudInfrastructure.Services.Cache
|
namespace AsbCloudInfrastructure.Services.Cache
|
||||||
{
|
{
|
||||||
public class CacheTable<TEntity> where TEntity : class
|
public class CacheTable<TEntity> : IEnumerable<TEntity>
|
||||||
|
where TEntity : class
|
||||||
{
|
{
|
||||||
private readonly DbContext context;
|
private readonly DbContext context;
|
||||||
private (DateTime refreshDate, IEnumerable<object> entities) data;
|
private (DateTime refreshDate, IEnumerable<object> entities) data;
|
||||||
@ -334,5 +335,9 @@ namespace AsbCloudInfrastructure.Services.Cache
|
|||||||
cached.AddRange(dbEntities);
|
cached.AddRange(dbEntities);
|
||||||
return dbEntities;
|
return dbEntities;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IEnumerator<TEntity> GetEnumerator() => Where().GetEnumerator();
|
||||||
|
|
||||||
|
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() => GetEnumerator();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user