Reputation: 14906
Is it possible to define a descending index in OrmLite? I can only see the [Index]
attribute but I have a table of over 1 million records and need a descending index.
Upvotes: 2
Views: 74
Reputation: 143349
If it's for a composite index you can specify it within its name:
[CompositeIndex("Field1", "Field2 DESC")]
public class Table
{
...
public string Field1 { get; set; }
public string Field2 { get; set; }
}
Otherwise you can use a Pre/Post Custom SQL Hooks, e.g:
[PostCreateTable("CREATE INDEX IX_NAME ON MyTable (Field1 DESC);")]
public class MyTable
{
...
public string Field1 { get; set; }
public string Field2 { get; set; }
}
Which will execute the Post SQL Hook to create the index after the table is created.
Upvotes: 2