icon Static Data Type Creator
Created by Orckestra

How to get the source code of data types

After you've installed the Composite.Tools.StaticDataTypeCreator package:

  1. In the Data perspective, right-click a data type.
  2. Click "Download Datatype Source Code" in the context menu.
  3. When prompted, download the generated .cs file.

How to use the data type's source code in your project

Once you get the .cs files, you should:

  1. Create a Class Library project and add required references to it
  2. Add one or more data type source code files (.cs files) to the project
  3. Build the assembly
  4. Back up the data from the dynamic data type these static data types are based.
  5. Delete the dynamic data types these static data types are based in the Data perspective in the CMS Console.
  6. Copy the assembly to the website's /Bin folder
  7. Restore the backed up data.

Important: Before adding the assembly with static data types to /Bin, make sure to back up their data and delete the dynamic data types used to create these static data types (see below).

Backing up data before deleting the original dynamic data types

The static data types you created in the way described above will have the same namespace and name as the dynamic data types they are based on. When you copy your assembly with these data types to /Bin, there will be the name conflict.

That's why you have to delete these original data types.

If you have these data types already contain data, deleting them will lead to deleting this data. Hence, before deleting the data types, back up the data and when the static data types are added to your website, restore this data from the backup:

  1. Go to /App_Data/Composite/DataStores on your website.
  2. Locate the XML files that bear the name of your dynamic data types you are about to delete. (Normally, there at least two of them, for example, Demo.Data.Type_Published.xml, Demo.Data.Type_Published_en-US.xml, etc).
  3. Copy them to some other folder (or back them up in any way convenient to you).
  4. Delete the original dynamic data types in the CMS Console and copy the assembly with their counterpart static data types to /Bin.
  5. Have Orckestra CMS create data stores for these data types.
  6. Copy the backed-up XML files back to /App_Data/Composite/DataStores (or bring them back form your backup) - overwriting XML files with the same names if necessary.

In this way, the static data types will take over the data from the deleted dynamic data types.

Important: Please note that you have to ensure that Orckestra CMS have created data stores for the added static data types (Step 5 above). You can either call DynamicTypeManager.EnsureCreateStore in your code once for each new static data type, or manually add a data item via the CMS Console if you use tree definitions to manage data from these static data types (see below).

Managing data from static data types in the CMS Console

To be able to add, edit or delete data items from these static data types in the CMS Console, you need to create tree definitions ("CMS Console Applications") and use data forms. Please see "Static IData Types".

For more information on static data types in general, please see "Data types using C#".