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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T02:53:09+00:00 2026-05-17T02:53:09+00:00

I have this query var temp = from x in ActiveRecordLinq.AsQueryable<Circuits>() where x.User_Created ==

  • 0

I have this query

var temp = from x in ActiveRecordLinq.AsQueryable<Circuits>()
                       where x.User_Created == false
                       orderby x.Description
                       select x;

From NHibernate Profiler
Query duration
-Database only: 7ms
-Total: 835ms

The query generated:

SELECT   this_.Circuit_ID     as Circuit1_35_0_,
     this_.[Description]  as column2_35_0_,
         this_.[User_Created] as column3_35_0_
FROM     dbo.Circuit this_
WHERE    this_.[User_Created] = 0 /* @p0 */
ORDER BY this_.[Description] asc

It seems like a pretty straightforward query. It returns 6821 rows. All I’m using this for is to populate a dropdownlist.

Thanks in advance

  • 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-05-17T02:53:09+00:00Added an answer on May 17, 2026 at 2:53 am

    Ok, if you insist on the 7k (I REALLY believe you should stop to rethink your design… but…), you could try doing an HQL query to just select the fields you need from the object, instead of querying for the objects themselves.

    With the query you have written, nHibernate is loading the data from the database which occurs pretty quickly as you have noted. But THEN based on the Linq query you have written it is initializing, populating and returning 7k Circuit objects. which is probably taking it a while…

    And since you aren’t actually using the “object” in any meaningful way in this case (just a text and value pair for the dropdown) you really don’t need nHibernate to build the objects.

    Try changing your code to just return the text/value pair with HQL or LinqToNHibernate.

    the HQL would look something like this:

    select c.description, c.id from Circuit c
    where c.ordercreated = false
    orderby c.description
    

    I know you can do this with LinqToNhibernate as well, I just don’t have any quick examples at hand.

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

Sidebar

Related Questions

I have this simple query -> var games = from p in _oListGames where
I have just started Entity Framework & linq and write this query var query
I have this query and its result implements IEnumerable . RoutesEntities routesModel = new
I have one XML file where values are stored in category element separated by
I am using SL 4, WCF RIA Services against Entity Framework 4.0. I have
This should be a quickie, but I'm scratching my head as to why this
I see that Session.Find(string query, object[] values, IType[] types) is obsolete, and the suggestion
I would like to create a compiled query which uses reusable where predicates. An
I've been looking at the following post and trying to apply it to mine

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.