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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T16:26:06+00:00 2026-05-11T16:26:06+00:00

How do I tell a LINQ data context to ignore either specific properties, or

  • 0

How do I tell a LINQ data context to ignore either specific properties, or all readonly properties, when binding a result set to an object?

I am working with some T-SQL statements that are difficult to express using LINQ, so I’m using the ExecuteQuery method of the data context to pass the straight T-SQL to the database.

If my class T has any readonly properties, I get exceptions at runtime when the data context tries to set those properties and fails because there’s no setter property. How do I tell the context to ignore those properties?

This is what I’m doing now. It works, but it sucks:

public bool IsPaidInFull {
    get { return NetTotal <= 0m; }
    set { /* needed so linq doesn't choke. Should never be set by hand */ }
}
  • 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-11T16:26:06+00:00Added an answer on May 11, 2026 at 4:26 pm

    Have you considered Linq to Entities? It may not be worth the trouble to convert your project, depending on how far along you are, or how much orm overhead you are comfortable with. However, this exact scenario would not be a problem in Linq to Entities. It does not try to update read only properties in the object when loading it, because they are not explicitly mapped, they are simply extension properties.

    Also, you could go the old-school/java route by using getter functions instead of properties. public bool getIsPaidInFull(){return NetTotal <= 0m;}.

    Or you could play around with implementing the read only properties in an inherited child class, but that may introduce all sorts of type issues.

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

Sidebar

Ask A Question

Stats

  • Questions 106k
  • Answers 106k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Try enabling anonymous login mode on your ejabberd server? Then… May 11, 2026 at 8:52 pm
  • Editorial Team
    Editorial Team added an answer A feature of modern ARM CPUs (and some others). From… May 11, 2026 at 8:52 pm
  • Editorial Team
    Editorial Team added an answer Macro's totally ignore scope. Basically the pre-precessor will do a… May 11, 2026 at 8:52 pm

Related Questions

I'm trying to do my linq 2 sql objects manually, so I have the
When writing manual SQL its pretty easy to estimate the size and shape of
I have a LINQ partial class: public partial class resp { public IEnumerable<RuleViolation> GetRuleViolations()
I'm binding a GridView to an LINQ query. Some of the fields in the
As a fairly junior developer, I'm running into a problem that highlights my lack

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.