none
Grabbing Sql with Parameters from a Code First Entity Framework 5 Implementation RRS feed

  • Question

  • Hello Everyone,

    I'm currently utilizing entity framework 5 with code first (utilizing code second actually) for a rewrite of one of our enterprise applications. This application is a windows forms application that will now be utilizing wpf over a wcf service based architecture for what it's worth. The previous product has this feature where any user can pull up a context menu of a grid, and view the actual sql that was used to generate the data in that grid. The dbContext class does afford me a .ToString() method off the returned DBQuery/IQueryable that gives me the query quite well. Unfortunately, it does not provide the parameters for that query which is especially important in this case.

    I have looked up several solutions including kowalski's EFTracingProvider that does not work with code first, and some spawns off of that with little luck. Does anyone have suggetions or have they run across code that effectively extends the .ToString() method to include parameters?

    Any suggestions would be greatly appreciated,

    Ryan

    Tuesday, January 15, 2013 8:38 PM

Answers

  • I utilized a slightly different version of the EFTracing application, but was able to get it to work. I was actually looking for the sql that the dbcontext was running against entity framework with parameters included. Thanks for the reply Alexander.
    • Marked as answer by RynBev Thursday, January 17, 2013 10:42 PM
    Thursday, January 17, 2013 10:39 PM

All replies

  • Hi Ryan,

    Welcome to the MSDN forum.

    I am not sure what parameters you mean for the query. Do you mean something like compiled query?

    Have a nice day.


    Alexander Sun [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Thursday, January 17, 2013 2:37 AM
  • I utilized a slightly different version of the EFTracing application, but was able to get it to work. I was actually looking for the sql that the dbcontext was running against entity framework with parameters included. Thanks for the reply Alexander.
    • Marked as answer by RynBev Thursday, January 17, 2013 10:42 PM
    Thursday, January 17, 2013 10:39 PM