Skip to content

Commit 43e3bee

Browse files
committed
Add generic methods to IProxyGenerator
1 parent a33ffb7 commit 43e3bee

File tree

1 file changed

+46
-1
lines changed

1 file changed

+46
-1
lines changed

src/Castle.Core/DynamicProxy/IProxyGenerator.cs

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1029,5 +1029,50 @@ object CreateClassProxy(Type classToProxy, Type[] additionalInterfacesToProxy, P
10291029
object CreateClassProxy(Type classToProxy, Type[] additionalInterfacesToProxy,
10301030
ProxyGenerationOptions options,
10311031
object[] constructorArguments, params IInterceptor[] interceptors);
1032+
1033+
/// <summary>
1034+
/// Creates proxy object intercepting calls to virtual members of type <typeparamref name = "TClass" /> on newly created instance of that type with given <paramref
1035+
/// name = "interceptors" />.
1036+
/// </summary>
1037+
/// <typeparam name = "TClass">Type of class which will be proxied.</typeparam>
1038+
/// <param name = "options">The proxy generation options used to influence generated proxy type and object.</param>
1039+
/// <param name = "constructorArguments">Arguments of constructor of type <typeparamref name = "TClass" /> which should be used to create a new instance of that type.</param>
1040+
/// <param name = "interceptors">The interceptors called during the invocation of proxied methods.</param>
1041+
/// <returns>
1042+
/// New object of type <typeparamref name = "TClass" /> proxying calls to virtual members of <typeparamref name = "TClass" /> type.
1043+
/// </returns>
1044+
/// <exception cref = "ArgumentNullException">Thrown when given <typeparamref name = "TClass" /> object is a null reference (Nothing in Visual Basic).</exception>
1045+
/// <exception cref = "ArgumentException">Thrown when given <typeparamref name = "TClass" /> is a generic type definition.</exception>
1046+
/// <exception cref = "ArgumentException">Thrown when given <typeparamref name = "TClass" /> is not a class type.</exception>
1047+
/// <exception cref = "ArgumentException">Thrown when no constructor exists on type <typeparamref name = "TClass" /> with parameters matching <paramref
1048+
/// name = "constructorArguments" />.</exception>
1049+
/// <exception cref = "TargetInvocationException">Thrown when constructor of type <typeparamref name = "TClass" /> throws an exception.</exception>
1050+
/// <remarks>
1051+
/// This method uses <see cref = "IProxyBuilder" /> implementation to generate a proxy type.
1052+
/// As such caller should expect any type of exception that given <see cref = "IProxyBuilder" /> implementation may throw.
1053+
/// </remarks>
1054+
public TClass CreateClassProxy<TClass>(ProxyGenerationOptions options, object[] constructorArguments, params IInterceptor[] interceptors);
1055+
1056+
/// <summary>
1057+
/// Creates proxy object intercepting calls to virtual members of type <typeparamref name = "TClass" /> on newly created instance of that type with given <paramref
1058+
/// name = "interceptors" />.
1059+
/// </summary>
1060+
/// <typeparam name = "TClass">Type of class which will be proxied.</typeparam>
1061+
/// <param name = "constructorArguments">Arguments of constructor of type <typeparamref name = "TClass" /> which should be used to create a new instance of that type.</param>
1062+
/// <param name = "interceptors">The interceptors called during the invocation of proxied methods.</param>
1063+
/// <returns>
1064+
/// New object of type <typeparamref name = "TClass" /> proxying calls to virtual members of <typeparamref name = "TClass" /> type.
1065+
/// </returns>
1066+
/// <exception cref = "ArgumentNullException">Thrown when given <typeparamref name = "TClass" /> object is a null reference (Nothing in Visual Basic).</exception>
1067+
/// <exception cref = "ArgumentException">Thrown when given <typeparamref name = "TClass" /> is a generic type definition.</exception>
1068+
/// <exception cref = "ArgumentException">Thrown when given <typeparamref name = "TClass" /> is not a class type.</exception>
1069+
/// <exception cref = "ArgumentException">Thrown when no constructor exists on type <typeparamref name = "TClass" /> with parameters matching <paramref
1070+
/// name = "constructorArguments" />.</exception>
1071+
/// <exception cref = "TargetInvocationException">Thrown when constructor of type <typeparamref name = "TClass" /> throws an exception.</exception>
1072+
/// <remarks>
1073+
/// This method uses <see cref = "IProxyBuilder" /> implementation to generate a proxy type.
1074+
/// As such caller should expect any type of exception that given <see cref = "IProxyBuilder" /> implementation may throw.
1075+
/// </remarks>
1076+
public TClass CreateClassProxy<TClass>(object[] constructorArguments, params IInterceptor[] interceptors);
10321077
}
1033-
}
1078+
}

0 commit comments

Comments
 (0)