RavenDB: how to transform a session.Query into a session.Advanced.DocumentQuery?

后端 未结 1 1440
广开言路
广开言路 2021-01-26 12:30

I stored the objects of the following classes in a ravendb database:

public class Continent
{
public string Name { get; set; }
public List Countri         


        
相关标签:
1条回答
  • 2021-01-26 13:00

    Note, this is probably not the best way to do this but it's the only way I know how. Also, note the following will create an index once executed.

    var results = session.Advanced.DocumentQuery<Continent>().Where("Countries,Provinces,Cities,Name: 123 AND Countries,Provinces,Cities,Address: aloma").ToList();
    

    Model structure used:

        public class Continent
    {
        public string Id { get; set; }
        public string Name { get; set; }
        public List<Country> Countries { get; set; }
    }
    
    public class Country
    {
        public string Name { get; set; }
        public List<Province> Provinces { get; set; }
    }
    
    public class Province
    {
        public string Name { get; set; }
        public List<City> Cities { get; set; }
    }
    
    public class City
    {
        public string Name { get; set; }
        public string Address { get; set; }
    }
    
    0 讨论(0)
提交回复
热议问题