Class Generator
Base of untyped generators.
Inheritance
System.Object
Generator
Namespace: Solti.Utils.Proxy.Internals
Assembly: Solti.Utils.Proxy.dll
Syntax
public abstract class Generator : TypeEmitter
Constructors
Generator(Object)
Base of untyped generators.
Declaration
protected Generator(object id)
Parameters
Type | Name | Description |
---|---|---|
System.Object | id |
Properties
Id
Unique generator id. Generators emitting the same output should have the same id.
Declaration
public object Id { get; }
Property Value
Type | Description |
---|---|
System.Object |
Methods
ActivateAsync(ITuple, CancellationToken)
Creates an instance of the generated type.
Declaration
protected Task<object> ActivateAsync(ITuple tuple, CancellationToken cancellation)
Parameters
Type | Name | Description |
---|---|---|
System.Runtime.CompilerServices.ITuple | tuple | A System.Runtime.CompilerServices.ITuple containing the constructor parameters or null if you want to invoke the parameterless constructor. |
System.Threading.CancellationToken | cancellation | Token to cancel the operation. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Object> | The just activated instance. |
GenerateId(String, IEnumerable<Type>)
Creates unique generator ids.
Declaration
protected static string GenerateId(string prefix, IEnumerable<Type> types)
Parameters
Type | Name | Description |
---|---|---|
System.String | prefix | |
System.Collections.Generic.IEnumerable<System.Type> | types |
Returns
Type | Description |
---|---|
System.String |
GetGeneratedType()
Gets the generated System.Type.
Declaration
public Type GetGeneratedType()
Returns
Type | Description |
---|---|
System.Type |
Remarks
The returned System.Type is generated only once.
GetGeneratedTypeAsync(CancellationToken)
Gets the generated System.Type asynchronously .
Declaration
public Task<Type> GetGeneratedTypeAsync(CancellationToken cancellation = null)
Parameters
Type | Name | Description |
---|---|---|
System.Threading.CancellationToken | cancellation |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Type> |
Remarks
The returned System.Type is generated only once.