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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T21:53:02+00:00 2026-05-23T21:53:02+00:00

I have the following compiled query added to my ASP.NET MVC 2 project (as

  • 0

I have the following compiled query added to my ASP.NET MVC 2 project (as a partial class definition to my LINQ to SQL DataContext):

namespace MyWebApp.DataAccessLayer.DataObject
{
    public partial class MyWebAppDataContext
    {
        public static Func<MyWebAppDataContext, int, IQueryable<PurchaseOrder>>
            POByID = CompiledQuery.Compile
                ((MyWebAppDataContextcontext, int poID) =>
                context.PurchaseOrders.Where(p => p.ID == poID));

        public IQueryable<PurchaseOrder> GetPObyID(int categoryID)
        {
            return POByID(this, categoryID);
        }
    }
} 

To get PurchaseOrder list I use this code in the controller:

using MyWebApp.DataAccessLayer.DataObject;
...    
...
var context = new MyWebAppDataContext("...connectionstring...");
var MyPOs = context.GetPObyID(3).ToList();

The IntelliSense does see GetPObyID() function and VS does not see any error in the code but I got the following compilation error:

“error CS1061: ‘MyWebApp.DataAccessLayer.DataObject.MyWebAppDataContext’ does not contain a definition for ‘GetPObyID’ and no extension method ‘GetPObyID’ accepting a first argument of type ‘MyWebApp.DataAccessLayer.DataObject.MyWebAppDataContext’ could be found (are you missing a using directive or an assembly reference?)”

Any suggestions?
Thanks

  • 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-23T21:53:02+00:00Added an answer on May 23, 2026 at 9:53 pm

    I could not reproduce your problem in VS2008.
    Which tool did you use to compile your project? I guess that the cs file which includes the first section code in your question was missed during the compiling.

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

Sidebar

Related Questions

I have the following code compiled by gcc: #include <iostream> using namespace std; class
I have the following compiled query that I want to return a list of
I have the following LINQ query var meshesList= ( from element in elementCoord.Elements let
I have the following compiled query. private static Func<Db, int, IQueryable<Item>> func = CompiledQuery.Compile((Db
I am using the PayPal sandbox in ASP.Net C# 4.0. I added the following
I have the following function in my iPhone project which works great...unless the query
I have the following LINQ query in an application. The data source is a
I have a following LINQ-to-entities query IQueryable<History<T>> GetFirstOperationsForEveryId<T> (IQueryable<History<T>> ItemHistory) { var q =
I have a problem with the following Linq query using Entity Framework: from o
I have a following problem: I compiled my application on Linux Ubuntu 9.10 using

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.