1

I am trying to generate sql query using .ToTraceString() in entity framework 3,5; but I am getting the following error

Cannot convert type 'System.Collections.Generic.List to 'System.Data.Objects.ObjectQuery'

I have the following code I need to generate sql query

                  customers= ent.Customer
                      .Include("UserType")
                      .Include("User")
                      .Where(c => c.Enabled == true)
                  .ToList<Customer>();

How to get sql query generated by entity framework. I don't have sql profiler.

Many thanks

1 Answer 1

1

Try not to call ToList() prior calling ToTraceString() because when you do you have list returned which doesn't have ToTraceString() method

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.