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

The Archive Base Latest Questions

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

I have an EF4.1 database first application, and the .ToString() method is only giving

  • 0

I have an EF4.1 database first application, and the .ToString() method is only giving me the reflected type, and not the SQL query.

How do I make my application show me the Linq query in SQL format?

I’ve added version 4.1 of C:\Program Files (x86)\Microsoft ADO.NET Entity Framework 4.1\Binaries\EntityFramework.dll to my project. I’m guessing the ToString feature is added by an extension method, but even when I add “Using system.data.Entity” I’m unable to getthe string output to work.

Does this mean ToString only works for Code First deployments?

  public IEnumerable<CompanyDetail> GetAllCompanies(int? startPage, int? stopPage, string Filter, int? MaxResults)
    {
        var t = from c in _entities.CompanyDetail
                select c;

        string test = t.ToString();

        var t2 = _entities.CompanyDetail;

        string test2 = t2.ToString();
        return t.ToList();
    }
  • 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-26T21:51:24+00:00Added an answer on May 26, 2026 at 9:51 pm

    I can confirm that it works for database first applications.

    I am guessing your code is still using the EF 4 classes since you didn’t mention adding the EF 4.1 DbContext generator to your model. If that’s the case, you can right-click on the model, choose “Add Code Generation Item…” and select the ADO.NET C# DbContext Generator. If you don’t see it in your installed templates, look for it under Online Templates.

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

Sidebar

Related Questions

I have setup EF4.2 (Database First) with my MVC3 site. I have to entities
Im creating a database via a code first application, the sql server contains no
I have a windows application working with a SQL Compact 4.0 database, using EF
I have a database which is created using EF4.1 code first. The data context
I have not hardly touched EF4, but I've used Linq to sql quite a
First some brief background: I have an existing ASP.NET MVC 1 application using Entity
I am new to EF using EF4 with Database First and generation taking place.
So I am learning MVC3 and EF4. I tried the code first method but
I have an MVC3 and EF 4 Code First application, which is configured to
I am writing my first WPF application. I have also installed Entity Framework (EF)

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.