如何在ServiceStack.OrmLite中查询复杂数据?

时间:2013-02-11 13:42:26

标签: servicestack ormlite-servicestack

我有以下课程:

class Device
{
    [AutoIncrement]
    public int Id { get; set; }
    public string Brand { get; set; }
    public string Name { get; set; }
    public string Price { get; set; }
    public DeviceType Type { get; set; }
    public Screen Display { get; set; }
}

enum DeviceType 
{ 
    Mobile, Tablet
};

class Screen
{
    public List<string> Options { get; set; }
}

我可以通过这样做来插入数据,

db.Insert(new Device { Name = "IPad2", Brand = "Apple", Price = "£450", Type = DeviceType.Tablet, Display = new Screen { Options = new List<string> { "opt1", "opt2", "opt3"} } });

和显示数据已添加到Display{Options:[opt1,opt2,opt3]}。 现在我无法理解写一个跟随查询。

SELECT * FROM Device WHERE Display option "opt1" ;

请帮忙。

1 个答案:

答案 0 :(得分:2)

您想要查询服务器端的任何内容都不应该是blobbed。解决方案是将它们从复杂类型中重构出来,并使它们成为第一类Classes / Tables。

相关问题