26 lines
572 B
C#
26 lines
572 B
C#
using Connected.Data.EntityProtection;
|
|
using Connected.Middleware;
|
|
|
|
namespace Connected.Data.DataProtection;
|
|
|
|
internal class EntityProtectionService : IEntityProtectionService
|
|
{
|
|
public EntityProtectionService(IMiddlewareService middleware)
|
|
{
|
|
Middleware = middleware;
|
|
}
|
|
|
|
public IMiddlewareService Middleware { get; }
|
|
|
|
public async Task Invoke<TEntity>(EntityProtectionArgs<TEntity> args)
|
|
{
|
|
var middleware = await Middleware.Query<IEntityProtector<TEntity>>();
|
|
|
|
if (!middleware.Any())
|
|
return;
|
|
|
|
foreach (var m in middleware)
|
|
await m.Invoke(args);
|
|
}
|
|
}
|