Fix missing await when invoking OnInvalidating
Fix equals calls on possibly null values in SelectExpression
This commit is contained in:
parent
e35dc32284
commit
94585fc3f2
@ -62,7 +62,7 @@ public abstract class EntityCacheClient<TEntity, TPrimaryKey> : StatefulCacheCli
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (OnInvalidating(ctx, id) is TEntity entity && entity is IPrimaryKey<TPrimaryKey> pk)
|
if ((await OnInvalidating(ctx, id)) is TEntity entity && entity is IPrimaryKey<TPrimaryKey> pk)
|
||||||
Set(pk.Id, entity, TimeSpan.Zero);
|
Set(pk.Id, entity, TimeSpan.Zero);
|
||||||
|
|
||||||
if (transaction is not null)
|
if (transaction is not null)
|
||||||
@ -82,10 +82,6 @@ public abstract class EntityCacheClient<TEntity, TPrimaryKey> : StatefulCacheCli
|
|||||||
if (context.GetService<IStorageProvider>() is not IStorageProvider provider)
|
if (context.GetService<IStorageProvider>() is not IStorageProvider provider)
|
||||||
return default;
|
return default;
|
||||||
|
|
||||||
var entities = await provider.Open<TEntity>().AsEntities();
|
|
||||||
|
|
||||||
var entity = entities.FirstOrDefault(e => e.Id.Equals(id));
|
|
||||||
|
|
||||||
return await (from dc in provider.Open<TEntity>()
|
return await (from dc in provider.Open<TEntity>()
|
||||||
where TypeComparer.Compare(dc.Id, id)
|
where TypeComparer.Compare(dc.Id, id)
|
||||||
select dc).AsEntity();
|
select dc).AsEntity();
|
||||||
|
@ -55,9 +55,9 @@ public sealed class SelectExpression : AliasedExpression
|
|||||||
if (obj is not SelectExpression second)
|
if (obj is not SelectExpression second)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return Alias.Equals(second.Alias)
|
return Alias == second.Alias
|
||||||
&& Columns.Equals(second.Columns)
|
&& Columns == second.Columns
|
||||||
&& From.Equals(second.From)
|
&& From == second.From
|
||||||
&& Where == second.Where
|
&& Where == second.Where
|
||||||
&& OrderBy == second.OrderBy
|
&& OrderBy == second.OrderBy
|
||||||
&& GroupBy == second.GroupBy
|
&& GroupBy == second.GroupBy
|
||||||
|
Loading…
x
Reference in New Issue
Block a user