문제

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; }
}
도움이 되었습니까?

해결책

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; }
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top