CSLA.NET 6.0.0
CSLA .NET is a software development framework that helps you build a reusable, maintainable object-oriented business layer for your app.
InterceptorManager.cs
Go to the documentation of this file.
1//-----------------------------------------------------------------------
2// <copyright file="InterceptorManager.cs" company="Marimer LLC">
3// Copyright (c) Marimer LLC. All rights reserved.
4// Website: https://cslanet.com
5// </copyright>
6// <summary>Cascades DataPortal interception requests to registered interceptors</summary>
7//-----------------------------------------------------------------------
8using System.Collections.Generic;
9
10namespace Csla.Server
11{
15 public class InterceptorManager
16 {
17 private readonly IReadOnlyList<IInterceptDataPortal> _interceptors;
18
23 public InterceptorManager(IEnumerable<IInterceptDataPortal> interceptors)
24 {
25 _interceptors = new List<IInterceptDataPortal>(interceptors);
26 }
27
33 {
34 foreach (IInterceptDataPortal interceptor in _interceptors)
35 {
36 interceptor.Initialize(e);
37 }
38 }
39
44 public void Complete(InterceptArgs e)
45 {
46 // Iterate backwards through interceptors, so that they appear to wrap one another, decorator-style
47 for (int interceptorIndex = _interceptors.Count - 1; interceptorIndex > -1; interceptorIndex--)
48 {
49 IInterceptDataPortal interceptor = _interceptors[interceptorIndex];
50 interceptor.Complete(e);
51 }
52 }
53 }
54}
Arguments parameter passed to the interceptor methods.
Manage dataportal interception using DI-registered implementations
InterceptorManager(IEnumerable< IInterceptDataPortal > interceptors)
Creation of the manager, including all interceptors registered with the DI container
void Initialize(InterceptArgs e)
Cascade the initial interception request prior to the main DataPortal operation
void Complete(InterceptArgs e)
Cascade the final interception request after the main DataPortal operation has completed
Implement this interface to create a data portal interceptor that is notified each time the data port...
void Complete(InterceptArgs e)
Invoked at the end of each server-side data portal invocation for success and exception scenarios.
void Initialize(InterceptArgs e)
Invoked at the start of each server-side data portal invocation, immediately after the context has be...