GetTypeDelegate Delegate
Assembly: CodeEffects.Rule.Common.dll
Namespace: CodeEffects.Rule.Common.Models
Introduced in Version: 5.5.1.8
Summary
Defines the signature of a public method that takes a type's assembly-qualified name as its single parameter and returns the corresponding System.Type.
Syntax
public delegate Type GetTypeDelegate(string typeFullName);
Parameters
Returns
Type: System.Type
Remarks
If assemblies that declare in-rule methods or rule actions are updated to newer or different versions, all references saved in Rule XML or Source XML become obsolete because they are stored as assembly-qualified names. In such cases, you need to update those references accordingly.
This delegate helps resolve type versioning issues. Implement your own type resolver method following the signature of the GetTypeDelegate delegate, and assign it to the TypeGetter property of the CodeEffects.Rule.Editor.Control editor's class to ensure that the editor loads your types according to your custom logic.
If set, the editor will attempt to invoke your method and use the resulting System.Type. If your method returns default, the editor will attempt a standard Type.Load(..) call. The editor rethrows standard reflection exceptions.
Example
using CodeEffects.Rule.Editor;
namespace MyProject
{
public class MyClass
{
public System.Type GetMyType(string typeFullName)
{
return MyTypeLoader.GetThatType(typeFullName);
}
public Control GetControl(string divEditorClientContainerID)
{
var editor = new Control(divEditorClientContainerID)
{
Mode = RuleType.Execution,
SourceType = typeof(Patient),
TypeGetter = GetMyType
};
}
}
}