x First time here? Check out the FAQ

Generating classes from Document Types

    Umbraco Document Types can be generated directly from the Umbraco UI.

    To generate the document types navigate to the Settings module within Umbraco and then right-click on the Document Types tree node. There is a new option Export as .NET code which will load the dialog for generating the .NET representations of the Document Types.

    There are three options for generating the .NET code:

    * Language

    * Data Context Name

    * Namespace


    LINQ to Umbraco can generate code in either C# or Visual Basic .NET. The default is C#

    Data Context Name

    LINQ to Umbraco uses a DataContext (similar to what is used by LINQ to SQL). The text entered in the textbox (default: Umbraco) will be used as the DataContext prefix.

    Note - You only need to enter the prefix, a postfix of DataContext is automatically added


    The entered text will be used as the namespace of the generated classes (default: Umbraco).


    Once the generator has run you will be prompted to save an extension-less file which is named the same as the DataContext prefix. The file will need to be saved into the Visual Studio project required and an extension added (the file is extension-less so that any pre-associated file extension handler will not be taken into account).