The guide for changing enum type name/namespace

Description

This guide describe how to change enum type name/namespace, after this enum was used in database enum fields. Two options are available:

  1. Manually
  2. Using "Settings->Enumerations" tool

OPTION #1: Changing enum type manually

  1. Let's say you have MyEnum enum, which is used in Test.enumField database field and you want to rename enum's type name to MyEnumNewName
  2. Create the copy of MyEnum enum with some unique name, let's say MyEnumTemp
  3. Change database field's enum type (MyEnum -> MyEnumTemp). Save database.
  4. Change C# enum type name in your IDE (MyEnum -> MyEnumNewName)
  5. Change database field's enum type (MyEnumTemp -> MyEnumNewName). Save database.
  6. Delete C# temporary enum MyEnumTemp

OPTION #2: Using "Settings->Enumerations" tool

  1. Rename enum type/namespace using your IDE
  2. Switch to BGDatabase window and click on Reload button. Database will not be loaded, cause enum type can not be loaded using old name/namespace
  3. Select "Settings->Enumerations" and add enum type name mappings (Old name->New name) for each change.
  4. Click on "Reload" button. Once database is loaded, click on both "Clear the mappings" and "Save repo" buttons

Extra tip

Use custom Attribute to mark enums, which are used inside database