public static T InterceptWithPolicy <T>(this IProxyGenerator generator, T instance, IReadOnlyPolicyRegistry policyReadOnlyRegistry) where T : class { if (instance == null) { throw new ArgumentNullException(nameof(instance)); } if (policyReadOnlyRegistry == null) { throw new ArgumentNullException(nameof(policyReadOnlyRegistry)); } var interceptor = new PolicyInterceptor(policyReadOnlyRegistry); return(generator.Intercept(instance, interceptor)); }
public static object InterceptWithPolicy(this IProxyGenerator generator, Type type, object instance, IReadOnlyPolicyRegistry policyReadOnlyRegistry) { if (instance == null) { throw new ArgumentNullException(nameof(instance)); } if (policyReadOnlyRegistry == null) { throw new ArgumentNullException(nameof(policyReadOnlyRegistry)); } var interceptor = new PolicyInterceptor(policyReadOnlyRegistry); return(generator.Intercept(type, instance, interceptor)); }