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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T08:00:59+00:00 2026-05-16T08:00:59+00:00

I have a class public class Item : IItem { public virtual Guid Id

  • 0

I have a class

public class Item : IItem
{
    public virtual Guid Id { get; set; }
    public virtual string Name { get; set; }
    public virtual bool IsActive { get; set; }
}
public interface IItem
{
    Guid Id { get; set; }
    string Name { get; set; }
    bool IsActive { get; set; }
}

public class ItemMap : ClassMap<Item>
{
    public ItemMap()
    {
        Id(x => x.Id);
        Map(x => x.Name);
        Map(x => x.IsActive);
    }
}

In my database I have created five items. Three that have the IsActive flag set to true and two that have it set to false.

When using the Interface it returns all five items:

        var q = from i in session.Linq<IItem>()
                where i.IsActive == true
                select i;

However, when using the concrete class it returns the proper three items:

        var q = from i in session.Linq<Item>()
                where i.IsActive == true
                select i;

EDIT
I have would like to return an Interface, because I have read that I should return non-concrete classes. Please note that in actuality, these Linq queries are in a repository in a different project (in case this becomes a web or WPF app)

  • 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-16T08:01:00+00:00Added an answer on May 16, 2026 at 8:01 am

    It looks like a bug in the old contrib Linq provider.

    Try with NHibernate 3, it works as expected.

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

Sidebar

Related Questions

I basically have: Public Class Job: MyBaseClass { public virtual string JobInformation {get;set;} ...
I have some custom type: [RdfSerializable] public class Item { [RdfProperty(true)] public string Name
Suppose I have public class Product: Entity { public IList<Item> Items { get; set;
I have this class: public class Item { public virtual int32 Id { get;
I have a domain class like this: public class DomainClass { public virtual string
I have a model item public class EntryInputModel { ... [Required(ErrorMessage = Description is
I have this class: public MyClass { public void initialize(Collection<String> data) { this.data =
I have such class public unsafe class EigenSolver { public double* aPtr {get; private
I have a simple class that looks like this: public class Item { //
So, I have an Invoice object like so: public class Invoice { public virtual

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.