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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T14:29:45+00:00 2026-06-03T14:29:45+00:00

I’m really impressed by Dapper micro OR/M, I really would like to use it

  • 0

I’m really impressed by Dapper micro OR/M, I really would like to use it as a side by side companion of some fully fledged OR/M, and my be evantually in place of it. I did not figure out anyway if there is some strategy to deserialize a hierarchy from db: for example the returned object for a recordset row would depend on a field ( the so called ‘discriminator’ in NH for example ). Furthermore the hierarchy can split more table via a join, so the type that represent the row will depend on the existence of the record in the other table. Having a hierarchy represented by a mixture of the two strategy above would be something that NH for example does not support, but that exist in the ‘relational life’. So the questions:

  • does Dapper handle such a scenario ?
  • does this scenario wanish the Dapper efforts in term of performance ?

Another topic is caching. Dapper cache for queries is a little to much aggressive, wouldn’t be better to have some “session like context” and have a query cache for each session, or would this again offend the main Dapper motivations ?

  • 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-03T14:29:46+00:00Added an answer on June 3, 2026 at 2:29 pm

    At the moment Dapper does not support custom construction logic, I guess what you are asking for is something like:

    class Post {}
    class Question : Post { .. }
    class Answer : Post { ... }
    
    Func<IDbDataReader, Func<IDbDataReader, Post>> factoryLocator
            = ... my magic factory locater; 
    
    cnn.Query<Post>(@"
    select * from Posts p 
    left join Questions q on q.Id = p.Id 
    left join Answers a on a.Id = p.Id", factoryLocator: factoryLocator);
    

    We decided against implementing such logic cause we never really had to solve a problem like this in real life. It also introduces a fair amount of internal complexity and a fair amount of external complexity (as you need to switch on post is Question).

    I am not categorically against including this kind of feature if you can make a good argument for inclusion and the patch is simple. I am also all for adding hooks in Dapper to allow you to inject this kind of functionality.

    As to the caching strategy, we find that in general use we never ever bloat the cache, bloating only happens if you are misusing dapper by say, generating unparameterized SQL. I totally support adding a hook that would allow you to specify your own cache provider instead of the ConcurrentDictionary used now.

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

Sidebar

Related Questions

I would like to count the length of a string with PHP. The string
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I would like to run a str_replace or preg_replace which looks for certain words
I have some data like this: 1 2 3 4 5 9 2 6
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I am trying to understand how to use SyndicationItem to display feed which is
I've got a string that has curly quotes in it. I'd like to replace
I want use html5's new tag to play a wav file (currently only supported

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.