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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T04:21:37+00:00 2026-06-01T04:21:37+00:00

If I have a POCO class with ResultColumn attribute set and then when I

  • 0

If I have a POCO class with ResultColumn attribute set and then when I do a Single<Entity>() call, my result column isn’t mapped. I’ve set my column to be a result column because its value should always be generated by SQL column’s default constraint. I don’t want this column to be injected or updated from business layer. What I’m trying to say is that my column’s type is a simple SQL data type and not a related entity type (as I’ve seen ResultColumn being used mostly on those).

Looking at code I can see this line in PetaPoco:

// Build column list for automatic select
QueryColumns = (   from c in Columns
                   where !c.Value.ResultColumn
                   select c.Key
               ).ToArray();

Why are result columns excluded from automatic select statement because as I understand it their nature is to be read only. So used in selects only. I can see this scenario when a column is actually a related entity type (complex). Ok. but then we should have a separate attribute like ComputedColumnAttribute that would always be returned in selects but never used in inserts or updates…

Why did PetaPoco team decide to omit result columns from selects then?
How am I supposed to read result columns then?

  • 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-01T04:21:38+00:00Added an answer on June 1, 2026 at 4:21 am

    I can’t answer why the creator did not add them to auto-selects, though I would assume it’s because your particular use-case is not the main one that they were considering. If you look at the examples and explanation for that feature on their site, it’s more geared towards extra columns you bring back in a join or calculation (like maybe a description from a lookup table for a code value). In these situations, you could not have them automatically added to the select because they are not part of the underlying table.

    So if you want to use that attribute, and get a value for the property, you’ll have to use your own manual select statement rather than relying on the auto-select.

    Of course, the beauty of using PetaPoco is that you can easily modify it to suit your needs, by either creating a new attribute, like you suggest above, or modifying the code you showed to not exclude those fields from the select (assuming you are not using ResultColumn in other join-type situations).

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

Sidebar

Related Questions

I have a POCO: public class Role { public Int32 Id { get; set;
I have a database table and a corresponding entity class (POCO with change tracking
Is it possible to have a single POCO class that is made up of
I have an Entity Framework POCO class that is generated by a T4 Template.
I have created the POCO class and it's equivalent in edmx file (Category entity
I have the following POCO: Public Class T1 <Required()> <MaxLength(128)> <Key(), Column(Order:=0)> Property K1
I have an Entity Framework CodeFirst Class (POCO) : class Contract : IMyContract {
In my POCO class I have 16 attributes that are mapped to the database
I'm learning EF4.1 against the northwind database. I have created a POCO class like
I have converted an Entity framework project to use POCO objects by removing the

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.