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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T11:33:03+00:00 2026-06-05T11:33:03+00:00

Utilizing NHibernate I am attempting to use a lambda expression to retrieve objects based

  • 0

Utilizing NHibernate I am attempting to use a lambda expression to retrieve objects based on the status and values between a parent child relationship. AbstractWorkflowRequestInformation has a collection of WorkflowRequestInformationAction. Each of the two classes have their own Status properties. To illustrate here are the abbreviated classes as they relate to this query:

public class AbstractWorkflowRequestInformation
{
    public virtual RequestStatus RequestStatus { get; set; }

    public virtual IEnumerable<WorkflowRequestInformationAction>
        WorkflowRequestInformationActionList { get; set; }
}

public class WorkflowRequestInformationAction
{
    public virtual ActionStatus Status { get; set; }

    public virtual string RoleIdentifier { get; set; }

    public virtual string RoleName { get; set; }
}

Given this relationship I want to retrieve AbstractWorkflowRequestInformation objects based on a List<KeyValuePair<string, string>> called roles. I realize that the exception is being caused by a lack of parsing of the Any(...) extension method, but I am unsure of alternative queries. Thus far all permutations on the below query have caused the same or similar exceptions:

public IEnumerable<IRequestInformation> GetRequestsPendingActionBy(
        List<KeyValuePair<string, string>> roles)
{
    var results = GetSession().Query<AbstractWorkflowRequestInformation>()
        .Where(r => r.RequestStatus == RequestStatus.Pending
                    && r.WorkflowRequestInformationActionList
                        .Any(a => ActionStatus.Pending == a.Status
                                  && roles.Any(kp => kp.Key == a.RoleName
                                               && kp.Value == a.RoleIdentifier)))
    .ToList();

    return results;
}

The ultimate goal is to retrieve only those AbstractWorkflowRequestInformation objects which are pending and have a pending WorkflowRequestInformationAction matching a KeyValuePair in the roles enumerable.

I am not wedded to using a lambda expression as this expression has already grown unwieldy, if there’s a more elegant ICriteria expression I am all ears. What are my options to restrict my results based upon the values in my roles List<KeyValuePair<string, string>> but prevent the “Specified method is not supported” exception?

  • 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-05T11:33:05+00:00Added an answer on June 5, 2026 at 11:33 am

    I think this would get same results…

    WorkflowRequestInformationAction actionAlias = null;
    
    var q = GetSession().QueryOver<AbstractWorkflowRequestInformation>()
        .Inner.JoinAlias(x => x.WorkflowRequestInformationActionList,
                              () => actionAlias)
        .Where(x => x.RequestStatus == RequestStatus.Pending)
        .And(() => actionAlias.Status == ActionStatus.Pending);
    
    var d = Restrictions.Disjunction();
    
    foreach(var kvp in roles) 
    {
        d.Add(Restrictions.Where(() => actionAlias.RoleName == kvp.Key
                                      && actionAlias.RoleIdentitifier == kvp.Value));
    }
    
    q.And(d).TransformUsing(Transformers.DistinctRootEntity);
    
    var results = q.List();
    

    You could probably take a similar approach with NH Linq. I’m more comfortable with QueryOver/Criteria though.

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

Sidebar

Related Questions

I'm trying to use Subversion as Maven repo utilizing Maven wagon . If I
I am having a problem in Fluent NHibernate example utilizing the Many-to-Many relationships. I
I'm utilizing Entity Framework 4.3 Migrations in my project. I would like to use
Does anyone implement Dynamics CRM claims based authentication utilizing existing STS? White paper says:
I am attempting to create a website utilizing PHP as the driving power behind
Is there any way (utilizing Reflection I hope) that I can make an instantiated
I am utilizing the javax.scripting with Rhino in this project. I have a Java
I'm am utilizing a formset to enable users subscribe to multiple feeds. I require
I'm utilizing the code posted by Jesper Palm here: Make user control display outside
Given a large legacy project utilizing ASP.NET, javascript, css, etc, technologies, I was wondering

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.