Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7841107
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T16:01:42+00:00 2026-06-02T16:01:42+00:00

I am retrieving profile details with the following: var profiles = connection.Query<Models.PROFILE>( SELECT *

  • 0

I am retrieving profile details with the following:

var profiles = connection.Query<Models.PROFILE>(
    "SELECT * FROM PROFILES WHERE ID=@ID", 
    new { ID = profileID }); // IEnumerable
var profile = profiles.First<Models.PROFILE>();

The profile object contains other collections like profileImages. The problem is that the item count for every child object is zero. Also I only want to get data for say, profileImages.

Is there something that needs to be set to query the child objects, and if so, is it possible to specify which one and for how many levels?

I have also tried multimapping:

var profiles = connection.Query<Models.PHOTOS_PERMISSIONS,
                                Models.PROFILE,
                                Models.PHOTOS_PERMISSIONS>(sql,
                    (p1, p2) => { p1.ID = profileID; return p1; }, 
                    new { ID = profileID }, 
                    splitOn: "OWNER_PROFILESIDFK, ID").AsQueryable();

PHOTOS_PERMISSIONS.OWNER_PROFILESIDFK = PROFILE.ID

And getting the following error:

When using the multi-mapping APIs ensure you set the splitOn param if
you have keys other than Id Parameter name: splitOn

I have tried variations of what’s in my splitOn text, but still get the same error.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T16:01:43+00:00Added an answer on June 2, 2026 at 4:01 pm

    Dapper doesn’t support a One-To-Many mapping like this out of the box. Check out this question, it may help though.

    Multi-Mapping, one-to-many

    If your PROFILEIMAGES table has a FK on PROFILES ID – you could issue 2 querys and use the GridReader.

    var sql = 
    @"
    select * from PROFILES where profileId= @id
    select * from PROFILEIMAGES where OWNER_PROFILESIDFK = @id";
    
    using (var multi = connection.QueryMultiple(sql, new {id=selectedId}))
    {
       var profile = multi.Read<Models.PROFILE>().Single();
       profile.ProfileImages = multi.Read<Model.PROFILEIMAGES>().ToList();
    } 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am retrieving results from twitter using jQuery using the following code: $(document).ready(function(){ var
I am retrieving the details from the database and printing them in the XML
For retrieving image from blobstore, I usually do the following and it works: <img
need some help with retrieving information+Profile pic from twitter using php , i wanted
I am retrieving 3 fields from a database, and by default, only the username
We have a flash retrieving information from an XML file. Right now we are
I'm retrieving a float value from a mysql database on a php page (2.5,
I am retrieving data from an Oracle database and binding the same to a
I'm retrieving a file from a database server and allowing the user to download
I am retrieving one query string parameter, and for that my code is <a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.