How do I get second level public properties in ServiceStack

23 views Asked by At

I have the following POCOs in my service model:

public class Personnel {
 ...

    [Ignore]
    [Reference]
    public List<Posting> _Postings { get; set; }
}

public class Posting {
    ...

    [Reference]
    [Ignore]
    public Personnel Personnel { get; set; }

    [Reference]
    [Ignore]
    public Position _Position { get; set; }
}

public class Position {
    ...

    [Reference]
    [Ignore]
    public List<Posting> _Postings { get; set; }
}

When I use AutoQuery RDBMS to get Personnel I want to be able to get e.g. Personnel._Postings[1]._Position.Title.

How do I get the Position object which is a second level public property to Personnel using ServiceStack AutoQuery RDBMS? Please help.

1

There are 1 answers

0
mythz On

Don't use [Ignore] that tells OrmLite and AutoQuery to ignore the property.

AutoQuery automatically returns nested results but your Data Models need to follow OrmLite's Reference Conventions.