dapper를 사용 중입니다. splitOn 함수를 구현하여 AdListingSearchResult에 설정된 위치 개체를 가져 왔지만 하위 쿼리 (MainPhotoFileName 및 TotalPhotos)가 이제 null과 0이됩니다. 내가 여기서 뭘 잘못하고 있는거야?dapper의 하위 쿼리가 더 이상 작동하지 않습니다.
var data = GetConnection().Query<AdListingSearchResult, AdListingLocationSearchResult, AdListingSearchResult>(@"
SELECT TOP 10 a.AdListingID, a.Title, a.Details, a.CreateDateTime, l.LocationID, l.CountryID, l.USCity, l.USStateCode, l.IntlRegion, c.CountryName,
(SELECT TOP 1 ap.Filename FROM tbAdListingPhotos ap WHERE ap.AdListingID = a.AdListingID) AS MainPhotoFileName,
(SELECT COUNT (*) FROM tbAdListingPhotos ap WHERE ap.AdListingID = a.AdListingID) AS TotalPhotos
FROM tbAdListing a
INNER JOIN tbLocation l ON (a.LocationID = l.LocationID)
INNER JOIN tbEnumCountry c ON (l.CountryID = c.CountryID)
WHERE a.Deleted = 0 ORDER BY a.CreateDateTime DESC
", (a, l) =>
{
a.Location = l;
return a;
},
splitOn: "LocationId"
).AsQueryable();
return data;
어떤 물체은'MainPhotoFileName' (등) 특성을 가지고? 'AdListingSearchResult'? 또는 'AdListingLocationSearchResult'? –