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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T18:41:27+00:00 2026-06-09T18:41:27+00:00

I have this object called Event, and event has some other linked tables. [PetaPoco.ResultColumn]

  • 0

I have this object called Event, and event has some other linked tables.

[PetaPoco.ResultColumn]
public Models.User Presenter { get; set; }

Petapoco does a wonderful job by fetching my objects when I use:

evt = db.Fetch<Models.Event, Models.User>(";EXEC GetEventDetails @id", new { id = id });

This brings me the event, with the presenter data.

But the problem is that I also have a column being generated in my query ‘Available seats’
This column is linked to the object as:

[PetaPoco.ResultColumn]
public string AvailableSeats { get; set; }

The problem is: when I use the db.Fetch, Available seats is null.
My solution now is:

evt = db.Fetch<Models.Event>(";EXEC GetEventDetails @id", new { id = id })[0];
evt.Presenter = db.FirstOrDefault<Models.User>("WHERE id=" + evt.PresenterId);

but I don’t really like this. it should be all in one line of code.

Is this a petapoco bug, or am I doing something wrong there?

  • 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-09T18:41:29+00:00Added an answer on June 9, 2026 at 6:41 pm

    My guess (without looking under the covers) it’s that PetaPoco only fill the corresponding table fields when you do a multi-join, because it need to guess witch field match with each table.

    My recommendation for these type of joins is to have a ViewModel object only with the properties needed. This is more clear and faster and only will take a few more minutes.

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

Sidebar

Related Questions

I have an object with a property called name. This object has a sub
This should be a simple one: I have an observableArray object called To in
I have this object: class a { public string Application; public DateTime From, To;
In this hypothetical example, imagine I have an object FooSet that has five properties
I have an object Proposal which has a property called CurrentAgency of Agency which
I have an array of event objects called events . Each event has markets
I have this object: stdClass Object ( [daily_inventoryID] => 1 [inventory_timestamp] => 2012-06-08 14:35:42
I have this object I'm loading with THREE.objLoader and then create a mesh with
I have this object which is an instance of a superclass. I want to
I have this object below: I thought about putting the messages in html like

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.