ORM Basics Adding Indexes
  • Updated on 09 Dec 2013
  • 1 minute to read
  • Print
  • Dark
    Light

ORM Basics Adding Indexes

  • Print
  • Dark
    Light

Adding Index to Field
Indexes can be declared on fields that have been marked to be stored by the ORM. An index name and a flag to say if index is unique can be added to this.
Below is an example of specifying an index on a field.

 [ORMField("entity_folder_id", typeof(KeyFieldConverter))]
[ORMFieldIndex("entity_folder_id_INDEX", false)]
private string entityFolderID;

Adding Index to Table
If an index includes more than one field, it can be specified at the table level.
Below is an example of specifying an index on a table.

 [ORMEntity("cache_entity")]
[ORMTableIndex("cache_entity_index", new string[]{ "configName", "instanceName", "itemId"}, true)]
class CacheEntity : BaseORMEntity
Was this article helpful?