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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T07:53:40+00:00 2026-05-27T07:53:40+00:00

I see articles on using SPMetal to generate the .cs file that allows LINQ

  • 0

I see articles on using SPMetal to generate the .cs file that allows LINQ to work properly. The file I’m talking about inherits from the Microsoft.SharePoint.Linq.DataContext class. How can I use LINQ without recompiling on my production environment, since I would need to regenerate this file using SPMetal on my production environment? I suspect the answer is going to be “can’t do it”.

I guess I’ll use a CAML query instead unless there is some easier way to use LINQ that I am missing.

  • 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-27T07:53:41+00:00Added an answer on May 27, 2026 at 7:53 am

    If the objective is just to query lists using LINQ and you want to avoid such recompilations, do not use SPMetal.
    LINQ can be directly used on SPListItemCollection
    e.g.

     var FindCustomer = from SPListItem Item in Customers.Items
                           where Item["Orders"] as int == 5
                            select Item;
    

    //or select new{Title = Item[“Title”]}

    This does not have hard coded entities but is more flexible. And as long as your list column names remain same, code can be deployed on any environment even if other lists are changing.
    Also you can choose to retrieve few chosen field’s data instead of retrieving data of all the fields every time.

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

Sidebar

Related Questions

I see many, many sites that have URLs for individual pages such as http://www.mysite.com/articles/this-is-article-1
Im using JSF time ago, and i see that the concept of MODEL is
I have several articles about Dependency Injection, and I can see the benefits, especially
I'm using Ckeditor in my site to insert articles. The articles usually come from
I see many times using native and literals keywords in C# articles. What do
I see lots of articles saying how great IoC and DI are and none
http://thedailywtf.com/Articles/The-Hot-Room.aspx You see how at the bottom there're links to the next and previous
First let me say that I did see this article: How to remove AspxAutoDetectCookieSupport
I see a bunch of articles on MSDN on how WMI can do all
I see plenty of tutorials and articles showing me how to make a simple

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.