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

  • Home
  • SEARCH
  • 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 6883805
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T05:25:43+00:00 2026-05-27T05:25:43+00:00

I have just run into quite surprising problem. The case is simple: return all

  • 0

I have just run into quite surprising problem.

The case is simple: return all entities that are currently active, which means: filter all result returned by GetAll() method according to their Boolean Active property

public IQueryable<T> GetAllActive()
{
      return implementation.GetAll().Where(a => ((IDeactivable)a).Active);  
}

where GetAll() method of implementation object is defined as:

public IQueryable<T> GetAll();

The problem is, that GetAllActive() returns all the records, regardless of value of their Active property, just like there is no Where clause.

What could be the reason for it?

Note: The code is simplified, T type is checked to implement the IDeactivable interface. Also no exception is thrown during at runtime.

Edit: IQueryable returned by implementation object comes from NHibernate

Edit2: I have used following code to check the actual values for the entities (besides using VS Debugger):

foreach (var a in active) {              //active -> filtered IQueryable before return
        _logger.Warn(a.Id);
        _logger.Warn(((IDeactivable)a).Active);
}

the result was:

11/30/2011 18:10:00 WARN xxx.Repository`1.GetAllActive: 70db43fa-2361-4c1f-a8e5-9fab012b5a2b
11/30/2011 18:10:01 WARN xxx.Repository`1.GetAllActive: False
11/30/2011 18:10:02 WARN xxx.Repository`1.GetAllActive: 5493c9bb-ec6e-4690-b5d6-9fab012b5b16
11/30/2011 18:10:02 WARN xxx.Repository`1.GetAllActive: True
  • 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-27T05:25:44+00:00Added an answer on May 27, 2026 at 5:25 am

    I have tried several different approaches and I finally I have found a part of my code not tested yet. It turned out that LINQ Queries to NHibernate caused some issues when using Where clause, that I have not noticed before.

    Eventually, I figured out, that I am using a wrong version of LINQ to NHibernate QueryProvider (not the one included in NH 3.0) and that is a known issue. Now that I have get rid of it, everything works fine. THANK YOU FOR YOUR HELP, GUYS! You pointed me out to the right direction.

    Mentioned issue is described in following thread:
    Problem with linq query

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

Sidebar

Related Questions

I've just installed VS2008 and have run into a problem that I'm sure can
Ok, I have just run into something that is really catching me off-guard. I
I've just started to use linq to sql and have run into a problem
This is an odd thing I've just run into. I have a web application
I just wanted some opinions from people that have run Selenium ( http://selenium.openqa.org )
When using simple DTOs in various scenarios I have frequently run into the same
We are designing a web site and have run into some UI challenges that
I have this script and when i try to run it, it just says
I have just inherited a server application, however it seems that the only copy
I'm really quite frustrated at this point. I have an existing hg repository that

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.