Names Mappings

Maybe the most striking difference when writing pages in Eiffel comes from the name of the .NET types and methods. Because of different naming conventions, overloading and differences in identifier validity rules, .NET identifiers cannot be mapped directly to Eiffel identifiers. As a consequence, the Eiffel compiler creates XML mapping files in the Eiffel Metadata Cache. These files are created only once for each referenced assembly.

Note: The ASP.NET installation program pre-generates the Eiffel Metadata Cache for all assemblies required by ASP.NET by default.

The name mapping algorithm is quite complex but it is possible to guess the Eiffel identifier from the .NET identifier in most cases. The following simple steps can be followed to retrieve the Eiffel identifier corresponding to a .NET type:

  1. Only the simple type name is used, the namespace isn't used by the Eiffel identifier:

System.Xml.NameTable -> NameTable

  1. Underscores are introduced in between words (prior to upper case letters other than the first character):

NameTable -> Name_Table

  1. Eiffel class names are always upper case:

Name_Table -> NAME_TABLE

  1. If the assembly containing the type is associated with a prefix in the Eiffel system then the prefix gets prepended to the name:

NAME_TABLE -> XML_NAME_TABLE

The steps to follow to retrieve the Eiffel identifier corresponding to a .NET member are simpler:

  1. For property getters, the "get_" prefix is removed:

get_MaxOccursString -> MaxOccursString

  1. Underscores are introduced in between words (prior to upper case letters other than the first character):

MaxOccursString -> Max_Occurs_String

  1. Eiffel feature names are always lower case:

Max_Occurs_String -> max_occurs_string

Although these simplified steps will work in most cases there are certain .NET identifiers that require additional manipulation to be translated into Eiffel. The Name Mapper utility should be used when such cases arise.

See Also: Name Mapper