I am using petapoco. and joining with 6 tables i am getting exception : can not make split point betweeen 2 tables, please let me know if any one have an idea about it.
//Data Access
public static List<UserAccountsPOCO> GetFavouriteList(UserAccountsPOCO objUserAccountsPoco, int CurrPage, int PageSize)
{
var context = new PetaPoco.Database(Connection.connectionstring);
SqlQuery =
@"SELECT
UserAccount.UserId, UserAccount.Gender, UserAccount.DisplayName, UserAccount.CountryOfOrigin,
UserAccount.CountryOfResidence, UserAccount.Tribe, UserAccount.Education, UserAccount.Occupation,
UserAccount.Height, UserAccount.BuildType, UserAccount.MartialStatus, UserAccount.ZipCode,
UserAccount.AboutMe, UserAccount.BirthDate,UserAccount.MainFileId, UserAccount.CreatedDate, UserAccount.LastEditedDate,
Qualification.QualificationName,MartialStatus.MartialStatus,BuildType.BuildTypeName, UserImages.ProfileImage,
FavouriteList.UserId, FavouriteList.CreatedDate
FROM
( SELECT
ROW_NUMBER() OVER (ORDER BY DisplayName) AS row,
UserAccount.UserId, UserAccount.Gender, UserAccount.DisplayName, UserAccount.CountryOfOrigin,
UserAccount.CountryOfResidence, UserAccount.Tribe, UserAccount.Education, UserAccount.Occupation,
UserAccount.Height, UserAccount.BuildType, UserAccount.MartialStatus, UserAccount.ZipCode,
UserAccount.AboutMe, UserAccount.BirthDate,UserAccount.MainFileId, UserAccount.CreatedDate, UserAccount.LastEditedDate FROM UserAccount
) AS UserAccount
Left join FavouriteList on UserAccount.UserId = FavouriteList.FavouriteUserId
Left join Qualification on UserAccount.Education = Qualification.QualificationId
Left join MartialStatus on UserAccount.MartialStatus = MartialStatus.MartialStatusId
Left join BuildType on UserAccount.BuildType = BuildType.BuildTypeId
Left join UserImages on UserAccount.UserId = UserImages.UserId
WHERE
row > " + ((CurrPage - 1) * PageSize) + " and row <= " + (CurrPage * PageSize) + "";
List<UserAccountsPOCO> obUserAccountPoco = context.Query<UserAccountsPOCO>(new Type[] { typeof(UserAccountsPOCO), typeof(FavouriteListPOCO), typeof(QualificationPOCO), typeof(MartialStatusPOCO), typeof(BuildTypePOCO), typeof(UserImagesPOCO) }, null,
SqlQuery,
new
{
@UserId = objUserAccountsPoco.UserId,
@CurrPage = CurrPage,
@PageSize = PageSize
}).ToList();
return obUserAccountPoco;
}
The column order must match the types specified in the array passed to the Query method. eg.
According to your columns it should be:
but you have: