0
嵌套的SELECT发生异常。如果你评论属性照片,生日和居住,那么一切正常。如何重写查询以使其工作?Mysql Linq已有一个与此连接关联的打开的DataReader,必须先关闭
var predicate = PredicateBuilder.True<Persons>();
var query = this._entity.Persons.AsExpandable();
#region
if (!String.IsNullOrEmpty(currentPerson.PersonName))
{
predicate = predicate.And(i => i.PersonName.Contains(currentPerson.PersonName.Trim()));
}
if (!String.IsNullOrEmpty(currentPerson.PersonLastName))
{
predicate = predicate.And(i => i.PersonLastName.Contains(currentPerson.PersonLastName.Trim()));
}
if (!String.IsNullOrEmpty(currentPerson.PersonPatronymic))
{
predicate = predicate.And(i => i.PersonPatronymic.Contains(currentPerson.PersonPatronymic.Trim()));
}
...........
var result = query.Where(predicate).AsEnumerable().Select(o => new POCO.PersonResult
{
Id = (int)o.Id,
Photo = o.persons_photos.Select(s => s.PersonFrontView).FirstOrDefault(),
FullName = String.Format("{0} {1} {2}", o.PersonLastName, o.PersonName, o.PersonPatronymic),
Birthday = o.persons_passport_data.Select(s => s.PersonBirthday).FirstOrDefault().ToString()
Residence = o.persons_registration
.Select(s =>
String.Join(", ", ListModel.GetCountry(s.PersonCountryId),
ListModel.GetRegion(s.PersonRegionId),
ListModel.GetCity(s.PersonCityId))).FirstOrDefault()
}).ToList();
是多活动结果集的选项murash?否则,我也在考虑include选项。 –
针对“MySQL MARS”的快速Google显示它们不受支持(因此无法像MSSQL提供程序那样打开) –