【发布时间】:2014-10-17 15:43:29
【问题描述】:
我在让一些 OrmLite 的东西工作时遇到了一些麻烦 - 我认为使用文档数据库的时间有点太长了!鉴于我有以下模型:
public class ListingEvent
{
public ListingEvent()
{
}
[AutoIncrement]
[PrimaryKey]
public int Id {
get ;
set;
}
public string Name { get; set; }
[ForeignKey(typeof(Location))]
public int LocationId {
get;
set;
}
}
public class Location
{
public Location()
{
ListingEvents = new List<ListingEvent>();
}
[AutoIncrement]
[PrimaryKey]
public int Id {
get ;
set;
}
public string Name { get; set; }
[Reference]
public List<ListingEvent> ListingEvents { get; set; }
}
还有以下查询:
var listingEvents = db.Select<ListingEventDto> (
db.From<Model.ListingEvent>()
.Join<Model.ListingEvent, Model.Location> ()
.Where<Model.ListingEvent> (le => locationIds.Contains (le.LocationId) && le.Name.Contains (request.Query))
.Or<Model.ListingEvent, Model.Location>((le, l) => l.Name.Contains(request.Query) == true)
.Limit (skip: request.Skip, rows: request.Take));
到底为什么(记住我已经尝试了这个的所有含义!)我得到这个错误:
error CodeInvalidOperationException message variable 'l' of type 'Model.Location' referenced from scope '', but it is not defined
【问题讨论】:
标签: servicestack ormlite-servicestack