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 8054459
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T08:09:25+00:00 2026-06-05T08:09:25+00:00

I have a customer who has dictated that I use Dapper ORM, which I’ve

  • 0

I have a customer who has dictated that I use Dapper ORM, which I’ve never used before. I have a problem with nested objects. I have a main class (Location) which has an embedded value object class (Address). The two classes look like this:

class Location {
    int Id;
    string LocationName;
    Address LocationAddress;
}

Class Address {
    string Street;
    string City;
    string State;
    string ZipCode;
}

The SQL:

SELECT Id, LocationName, Street, City, State, ZipCode FROM Locations

I’ve look at a number of examples but I just can’t get the query set up right. I just don’t understand Dapper enough to get the structure right.

  • 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-05T08:09:26+00:00Added an answer on June 5, 2026 at 8:09 am

    You could use the “splitOn” parameter in your dapper query.

    var sql = "SELECT Id, LocationName, Street, City, State, ZipCode FROM Locations";
    var conn = // your get connection logic here. 
    
    using(conn)
    {
     conn.Open();
     var locations = conn.Query<Location,Address,Location>(sql, (location, address) => 
                     {
                       location.LocationAddress = address;
                       return location;
                     }, splitOn: "Street");
    }
    

    SplitOn is required if your objects in the record set aren’t “split” by a column named “Id”.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a customer (a very old person) who wants an application that has
I have a Customer class that contains a property, MyProperty, which is of a
I have a Customer class which has a representative field....this field is initially blank
I have a Customer object which has a collection of ContactNumbers. Is it possible
I've got a scenario where we have a customer who has a linux hosted
I have a customer who has submitted to me about ten crash logs, and
I have several Customer s who book Appointment s. Each Appointment has exactly one
I have a abstract class called Customer which has some attributes shared amongst all
I have a customer who has legacy data stored in Oracle database. Such data
Suppose you've got a customer who wants an application that has its data centralized

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.