Castle.DynamicProxy2
Wraps a reference that is passed
ByRef and provides indirect load/store support.
Summary description for NewArrayExpression.
Here we try to match a constructor argument to its value.
Since we can't get the values from the assembly, we use some heuristics to get it.
a/ we first try to match all the properties on the attributes by name (case insensitive) to the argument
b/ if we fail we try to match them by property type, with some smarts about convertions (i,e: can use Guid for string).
We have the following rules here.
Try to find a matching type, failing that, if the parameter is string, get the first property (under the assumption that
we can convert it.
Attributes can only accept simple types, so we return null for null,
if the value is passed as string we call to string (should help with converting),
otherwise, we use the value as is (enums, integer, etc).
Provides appropriate Ldc.X opcode for the type of primitive value to be loaded.
Provides appropriate Ldind.X opcode for
the type of primitive value to be loaded indirectly.
Inspect the base method for generic definitions
and set the return type and the parameters
accordingly
Emits a load opcode of the appropriate kind for a constant string or
primitive value.
Emits a load opcode of the appropriate kind for the constant default value of a
type, such as 0 for value types and null for reference types.
Emits a load indirect opcode of the appropriate type for a value or object reference.
Pops a pointer off the evaluation stack, dereferences it and loads
a value of the specified type.
Emits a store indirectopcode of the appropriate type for a value or object reference.
Pops a value of the specified type and a pointer off the evaluation stack, and
stores the value.
Summary description for PropertiesCollection.
Provides appropriate Stind.X opcode
for the type of primitive value to be stored indirectly.
Base class that exposes the common functionalities
to proxy generation.
TODO:
- Use the interceptor selector if provided
- Add tests and fixes for 'leaking this' problem
- Mixin support
Used by dinamically implement
Generates a parameters constructor that initializes the proxy
state with just to make it non-null.
This constructor is important to allow proxies to be XML serializable
If callbackMethod is null the InvokeOnTarget implementation
is just the code to throw an exception
If callbackMethod is null the InvokeOnTarget implementation
is just the code to throw an exception
If true the invocation will implement the IChangeProxyTarget interface
Generates the constructor for the nested class that extends
Improvement: this cache should be static. We should generate a
type constructor instead
Performs some basic screening and invokes the
to select methods.
Checks if the method is public or protected.
Attributes should be replicated if they are non-inheritable,
but there are some special cases where the attributes means
something to the CLR, where they should be skipped.
Checks if the method has the same signature as a method that was marked as
one that should generate a new vtable slot.
Initializes a new instance of the class.
Type of the target.
The interfaces.
The options.
Initializes a new instance of the class.
The emitter.
The add method.
The remove method.
The attributes.
Finds the type of the method on target.
The method on interface.
Type of the proxy target.
Checks whether the given types are the same. This is
more complicated than it looks.
This is used by the ProxyObjectReference class durin de-serialiation, to know
which generator it should use
Returns the methods implemented by a type. Use this instead of Type.GetMethods() to work around a CLR issue
where duplicate MethodInfos are returned by Type.GetMethods() after a token of a generic type's method was loaded.
Handles the deserialization of proxies.
Resets the used for deserialization to a new scope.
This is useful for test cases.
Resets the used for deserialization to a given .
The scope to be used for deserialization.
By default, the deserialization process uses a different scope than the rest of the application, which can lead to multiple proxies
being generated for the same type. By explicitly setting the deserialization scope to the application's scope, this can be avoided.
Gets the used for deserialization.
As has no way of automatically determining the scope used by the application (and the application
might use more than one scope at the same time), uses a dedicated scope instance for deserializing proxy
types. This instance can be reset and set to a specific value via and .
Used during the target type inspection process.
Implementors have a chance to interfere in the
proxy generation process
Invoked by the generation process to know if
the specified member should be proxied
Invoked by the generation process to notify that a
member wasn't marked as virtual.
Invoked by the generation process to notify
that the whole process is completed.
Applied to the assemblies saved by in order to persist the cache data included in the persisted assembly.
Abstracts the implementation of proxy constructions
Implementors should return a proxy for the specified type.
The proxy base class.
The proxy generation options.
The generated proxy type.
Implementors should return a proxy for the specified
type and interfaces. The interfaces must be only "mark" interfaces
Implementors should return a proxy for the specified
interface that 'proceeds' executions to the
specified target.
Implementors should return a proxy for the specified
interface that delegate all executions to the
specified interceptor(s).
Implementors should return a proxy for the specified
interface that delegate all executions to the
specified interceptor(s) and uses an instance of the interface
as their targets, rather than a class. All IInvocation's
should then implement IChangeProxyTarget.
Gets the module scope used by this builder for generating code.
The module scope used by this builder.
Determines whether this assembly has internals visisble to dynamic proxy.
The asm.
Determines whether the specified method is internal.
The method.
true if the specified method is internal; otherwise, false.
Summary description for ModuleScope.
The default file name used when the assembly is saved using .
The default assembly (simple) name used for the assemblies generated by a instance.
Initializes a new instance of the class; assemblies created by this instance will not be saved.
Initializes a new instance of the class, allowing to specify whether the assemblies generated by this instance
should be saved.
If set to true saves the generated module.
Initializes a new instance of the class, allowing to specify whether the assemblies generated by this instance
should be saved and what simple names are to be assigned to them.
If set to true saves the generated module.
The simple name of the strong-named assembly generated by this .
The path and file name of the manifest module of the strong-named assembly generated by this .
The simple name of the weak-named assembly generated by this .
The path and file name of the manifest module of the weak-named assembly generated by this .
Returns a type from this scope's type cache, or null if the key cannot be found.
The key to be looked up in the cache.
The type from this scope's type cache matching the key, or null if the key cannot be found
Registers a type in this scope's type cache.
The key to be associated with the type.
The type to be stored in the cache.
Gets the key pair used to sign the strong-named assembly generated by this .
Gets the specified module generated by this scope, creating a new one if none has yet been generated.
If set to true, a strong-named module is returned; otherwise, a weak-named module is returned.
A strong-named or weak-named module generated by this scope, as specified by the parameter.
Gets the strong-named module generated by this scope, creating a new one if none has yet been generated.
A strong-named module generated by this scope.
Gets the weak-named module generated by this scope, creating a new one if none has yet been generated.
A weak-named module generated by this scope.
Saves the generated assembly with the name and directory information given when this instance was created (or with
the and current directory if none was given).
This method stores the generated assembly in the directory passed as part of the module information specified when this instance was
constructed (if any, else the current directory is used). If both a strong-named and a weak-named assembly
have been generated, it will throw an exception; in this case, use the overload.
If this was created without indicating that the assembly should be saved, this method does nothing.
Both a strong-named and a weak-named assembly have been generated.
The path of the generated assembly file, or null if no file has been generated.
Saves the specified generated assembly with the name and directory information given when this instance was created
(or with the and current directory if none was given).
True if the generated assembly with a strong name should be saved (see );
false if the generated assembly without a strong name should be saved (see .
This method stores the specified generated assembly in the directory passed as part of the module information specified when this instance was
constructed (if any, else the current directory is used).
If this was created without indicating that the assembly should be saved, this method does nothing.
No assembly has been generated that matches the parameter.
The path of the generated assembly file, or null if no file has been generated.
Loads the generated types from the given assembly into this 's cache.
The assembly to load types from. This assembly must have been saved via or
, or it must have the manually applied.
This method can be used to load previously generated and persisted proxy types from disk into this scope's type cache, eg. in order
to avoid the performance hit associated with proxy generation.
Users of this should use this lock when accessing the cache.
Gets the strong-named module generated by this scope, or if none has yet been generated.
The strong-named module generated by this scope, or if none has yet been generated.
Gets the file name of the strongly named module generated by this scope.
The file name of the strongly named module generated by this scope.
Gets the directory where the strongly named module generated by this scope will be saved, or if the current directory
is used.
The directory where the strongly named module generated by this scope will be saved when is called
(if this scope was created to save modules).
Gets the weak-named module generated by this scope, or if none has yet been generated.
The weak-named module generated by this scope, or if none has yet been generated.
Gets the file name of the weakly named module generated by this scope.
The file name of the weakly named module generated by this scope.
Gets the directory where the weakly named module generated by this scope will be saved, or if the current directory
is used.
The directory where the weakly named module generated by this scope will be saved when is called
(if this scope was created to save modules).
ProxyBuilder that persists the generated type.
The saved assembly contains just the last generated type.
Initializes a new instance of the class.
Saves the generated assembly to a physical file. Note that this renders the unusable.
The path of the generated assembly file, or null if no assembly has been generated.
This method does not support saving multiple files. If both a signed and an unsigned module have been generated, use the
respective methods of the .
Initializes a new instance of the class.
The hook.
Initializes a new instance of the class.
Initializes a new instance of the class.
The builder.
Initializes a new instance of the class.
Creates the class proxy.
Type of the target.
The interfaces.
The interceptors.
Creates the class proxy.
Type of the target.
The interceptors.
The constructor args.
Creates the class proxy.
Type of the target.
The interfaces.
The options.
The constructor args.
The interceptors.
Gets the proxy builder instance.
The proxy builder.
For interface proxies, this will point to the
on the target class