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

The Archive Base Latest Questions

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

Using SubSonic3, I have this generic method (thanks to linq guy, James Curran): public

  • 0

Using SubSonic3, I have this generic method (thanks to linq guy, James Curran):

    public List<T> GetFromList<T>( List<Guid> _IDs,
        Func<T, Guid> GetID,
        Func<IQueryable<T>> GetAll )
            where T : class, IActiveRecord
    {
        List<T> rc = null;
        var Results =
            from item in GetAll( )
            where ( _IDs as IEnumerable<Guid> ).Contains( GetID( item ) )
            select item;

        rc = Results.ToList<T>( );
        return rc;
    }

It is called with something like

List<Job> jresults = GetFromList( IDList,
    item => item.JobID,
    ( ) => Job.All( ) );

Where IDList is a List of guids that are keys to the table.

When not generic, the linq looks like this and works perfectly. I was quite impressed that SubSonic’s linq provider could take this code and turn it into SELECT * FROM Job WHERE JobID IN (a, b, c):

            var Results =
            from item in Job.All( )
            where ( _IDs as IEnumerable<Guid> ).Contains( item.JobID )
            select item;

I want to be able to call this method on tables other than Job, with keys other than JobID. The GetAll Func works because it returns the same IQueryable that Job.All( ) does, but GetID throws a run-time exception, “LINQ expression node of type Invoke is not supported”. GetID returns a value, but what I really need from it is something that Contains( item.JobID) would recognize as a column name and that the “where” syntax would accept. (I don’t show it here, but I have the same problem with orderby.)

Is that possible, with what you know of SubSonic3?

  • 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-16T23:25:59+00:00Added an answer on May 16, 2026 at 11:25 pm

    My solution was to pass in the expression that Where needed:

     public List<T> GetFromList( List<Guid> _IDs,
        Func<IQueryable<T>> GetAll,
        Expression<Func<T, bool>> _where )
            where T : class, U, IActiveRecord
    {
        List<T> rc = new List<T>( );
        if ( 0 < _IDs.Count )
        {
            if ( MAX_ITEMS > _IDs.Count )
            {
                var Results = GetAll( ).Where( _where );
                rc = Results.ToList( );
            }
            else
            {
                var Results =
                    from id in _IDs
                    join item in GetAll( ) on id equals item.KeyValue( )
                    select item;
                rc = Results.ToList( );
            }
        }
        return rc;
    }
    

    called by

      rc = GetFromList(
          IDList,
          ( ) => Job.All( ),
          ( item => ( IDList as IEnumerable<Guid> ).Contains( item.JobID ) ) );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

using SubSonic3 SimpleRepository; I have a table used for an email queue which has
Using online interfaces to a version control system is a nice way to have
Using TortoiseSVN against VisualSVN I delete a source file that I should not have
Using C# and System.Data.SqlClient, is there a way to retrieve a list of parameters
I have an issue when the Context.cs is generated. I have followed the SubSonic3
I have an ancient mess I'm trying to shovel into tiers using subsonic. Trouble
I have this slice of code IQueryable<Dealer> dealers = from dealer in Dealers join
Using jQuery's UI Tabs. This is my code. <div id=tabs> <ul> <li><a href=#tabs-1>Find a
I have begun using SubSonic and I am wondering how to get it to
I have a class named Product in class library project. I am using SubSonic

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.