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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T13:49:37+00:00 2026-06-10T13:49:37+00:00

I am trying to build some custom extensions onto EF (4.3) using ObjectQuery’s ToTraceString()

  • 0

I am trying to build some custom extensions onto EF (4.3) using ObjectQuery’s ToTraceString() to generate raw SQL from LINQ code.

I’ve noticed that while in some cases the names of the columns in SQL match the property names of the query’s element type, in other cases they are named things like C1, C2, etc. This makes it very difficult for me to do anything with the generated SQL. Does anyone know how to map these column names back to property names (I only care about being able to do this for flat tuples such as anonymous types if that helps, I don’t need anything hierarchical).

A solution that relies on private/internal reflection is perfectly acceptable. I understand that I may have to adjust it with future EF releases. Also, I am only using MS SqlServer (2008+) if it helps.

  • 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-10T13:49:39+00:00Added an answer on June 10, 2026 at 1:49 pm

    I just asked and answered a similar question (you can ignore all the DataTable stuff, but it might be useful in that it shows how the mapping is used):

    Entity Framework – IQueryable to DataTable

    The original post that shows how to get at the mapping between the object property positions and SQL statement column positions can be found here:

    How does Entity Framework manage mapping query result to anonymous type?

    Note: The second link only provides a mapping of the positions (as integer values) between the object properties and the SQL statement columns…you’ll have to use reflection to get at the actual object property names and then do some kind of string analysis on the SQL statement to get the SQL statement column names (you could use regular expressions for this, but that might be overkill).

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

Sidebar

Related Questions

I'm trying to build an archetype structure like this, a webapp with some custom
I am trying to build an array of custom object references. Here is some
I'm trying to build a custom configuration and with some reason, I can't get
I have been trying to build a user control with some custom properties set
I'm trying to build a custom framework but for some reason, there is never
Trying to convert an existing Android build system using Ant with 'ant_rules_r3.xml' integration from
I am trying to add some custom build steps to my headless build process
I am trying to draw an isometric square with some custom code to build
I'm trying to build some .ascx controls into a class library for plugins for
I am trying to build some sort of a javascript antivirus that would try

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.