namespace zero.Communication; public sealed class CollectionInterceptorShim : CollectionInterceptor where T : ZeroIdEntity { ICollectionInterceptor _base; public CollectionInterceptorShim(ICollectionInterceptor baseInterceptor) { _base = baseInterceptor; } InterceptorResult Result(InterceptorResult result) { return result == null ? null : new InterceptorResult() { InterceptorHash = result.InterceptorHash, Parameters = result.Parameters, Prevent = result.Prevent, Result = result.Result != null ? EntityResult.From(result.Result, result.Result.Model as T) : null }; } /// public override bool CanRun(InterceptorParameters args, T model) => _base.CanRun(args, model); /// public override async Task> Creating(InterceptorParameters args, T model) => Result(await _base.Creating(args, model)); /// public override async Task> Updating(InterceptorParameters args, T model) => Result(await _base.Updating(args, model)); /// public override async Task> Saving(InterceptorParameters args, T model) => Result(await _base.Saving(args, model)); /// public override async Task> Deleting(InterceptorParameters args, T model) => Result(await _base.Deleting(args, model)); /// public override Task Created(InterceptorParameters args, T model) => _base.Created(args, model); /// public override Task Updated(InterceptorParameters args, T model) => _base.Updated(args, model); /// public override Task Saved(InterceptorParameters args, T model) => _base.Saved(args, model); /// public override Task Deleted(InterceptorParameters args, T model) => _base.Deleted(args, model); }