Enum Type Import Definitions

To use enum types as the core types for type shortcuts, the designer has to know where to load the enum types from. It uses type imports files which define which assemblies contain enum types. After type import files are loaded, the enums are available in the Type Shortcuts of the project and you can define new type shortcuts based on them.

As all target frameworks support enum types directly, you don't need type converters to work with enum types: it's enough to import the enum types in the designer using type import files.

Location and file format

TypeImport files, with the extension .typeimports are small XML files which are stored in TypeConverter folders (either the default type converter folder of the designer or the additional type converter folder specified in the Project Settings) or in the folder from which the project was loaded.

For example, if your project is called MyCRMProject.llblgenproj, the type imports file has to be called MyCRMProject.llblgenproj.typeimports

The format is as follows:

<typeImports>
    <typeImport typeName="" assemblyFile=""/> 
</typeImports>

The XML is stored in .typeimports files which are all read at project load (at the same time when Type Converters are read from the same folder(s)). typeName is the name to use to obtain a Type instance using the System.Type .NET class. assemblyFile is the filename + full path, which points to an assembly to load which contains the type specified. If the type isn't an enum type, the type is ignored. If assemblyFile is omitted, the system will try to instantiate the type without the filename, e.g. through a type-lookup in the current appDomain.

Examples

Enum type is part of a globally available assembly

The most basic typeimports file is the one which references a type that's in an assembly that's in the GAC or otherwise in an assembly that's directly discoverable by the designer:

<typeImports>
    <typeImport typeName="System.ConsoleColor"/>
</typeImports>

Enum type is part of a non-globally available assembly

More advanced are types which are present in an assembly that's local to the project and thus not available from the GAC: the designer can only load the assembly if its path is fully specified.

<typeImports>
    <typeImport typeName="EnumTypes.CategoryType" assemblyFile="\Myprojects\MyEnumDlls\EnumTypes.dll"/>
</typeImports>

Enum type is nested inside a type that's part of a non-globally available assembly

Enum types nested inside a class type need a different specification: using a + delimiter. Below is an example of an enum type InnerEnum that's nested inside the class ClassWithInner that's present an assembly that's local to the project and thus not available from the GAC: the designer can only load the assembly if its path is fully specified.

<typeImports>
    <typeImport typeName="EnumTypes.ClassWithInner+InnerEnum" assemblyFile="\Myprojects\MyEnumDlls\EnumTypes.dll"/>
</typeImports>

Re-loading .typeimports files

If you have created a .typeimports file and you want to import its contents, you don't need to restart the designer. You can re-load the .typeimports files by right-clicking the project node in the Project Explorer, and select Re-scan for TypeConverters and .typeimports files from the context menu.

Check which types are loaded

To see which types are loaded, use from the main menu: Tools -> View Loaded External Types... This will show all loaded external types, including enum types. If your enum type isn't present, please check the Application Output Pane in the designer (docked at the bottom) to see whether an error occurred during type load.