1
votes

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

1 Answers

1
votes

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