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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T09:36:11+00:00 2026-06-12T09:36:11+00:00

I recently started working with ServiceStack and its ORMLite framework. I have searched on

  • 0

I recently started working with ServiceStack and its ORMLite framework. I have searched on Google and browsed the source code but couldn’t find anything relevent.

Is there any way to select specific columns when executing a query with ORMLite ?
Something like that : Db.First<Model>(q => q.Id == someId, "Column1, Column2")

Unless I missed this feature, I am surprised nobody asked about this before, since this is one the rule of thumbs to optimize your DB transactions.

  • 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-12T09:36:12+00:00Added an answer on June 12, 2026 at 9:36 am

    If you want to specify columns other that the table you need to use SQL as seen in this earlier example

    So in your case you could do something like:

    Db.First<Model>("SELECT Column1, Column2 FROM AnyTableOrView");
    

    You can also create a partial model that looks at your table by decorating it with the [Alias] attribute, like:

    [Alias("AnyTableOrView")]
    public class Model {
        public int Id { get; set; }
        public string Column1 { get; set; }
        public string Column2 { get; set; }
    }
    

    Then you can do something like:

    Db.First<Model>(q => q.Id == someId);
    

    And it will only SELECT + populate fields from the partial model.

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

Sidebar

Related Questions

I have recently started working on some open source project which I found relevant
I have recently started working on a legacy application that has most of its
Have recently started working with Sitecore 6.2. Is there a way to preserve code
This is a very elementary I realize, I have recently started working with asp.net
i have recently started working on C# and i am very amateur at it
I have recently started working on an app which has both Java and native
I have recently started working on my master thesis in C that I haven't
I have recently started working in iOS Development, I have noticed the app size
I recently started working with Eclipse for Android development. When debugging through the code,
I've recently started working with multi-threaded Winform applications and have run up against 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.