You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
}
|