Question

Is there a way to create a composite non-unique index in Servicestack's implementation of Ormlite?

For example, a single index that would cover both Field1 and Field2 in that order.

public class Poco
{
    [AutoIncrement]
    public int Id { get; set; }
    ...

    public string Field1 { get; set; }
    public string Field2 { get; set; }
}
Was it helpful?

Solution

You can use the CompositeIndexAttribute, e.g:

[CompositeIndex("Field1", "Field2")]
public class Poco
{
    [AutoIncrement]
    public int Id { get; set; }

    public string Field1 { get; set; }
    public string Field2 { get; set; }
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top