SQL CommandText lost in ToJson() / FromJson()


#1

MiniProfiler.ToJson() will serialize the SqlTime.FormattedCommandString (which only has a getter) and not CommandString (which is tagged with [ScriptIgnore])

This means that if you do the following:

var profiler2 = MiniProfiler.FromJson(MiniProfiler.ToJson(profiler));

Any SQL command text is lost.


#2

I wasn’t actually running that code, but it was a concise way to report and test the problem. What I was really doing is having my webpage call a service that ran SQL and trying to merge the timings together (similar to how the WCF code in MiniProfiler works).


#3

It is also painful if you stab yourself…but why would you do that? :slight_smile:

Seriously, though. Why do you need to do that?


#4

@joe see http://stackoverflow.com/questions/10507582/why-is-mini-profiler-only-showing-executestorecommands-for-the-sql-text for context, I asked for this to be sent here


#5

@sam that’s cool. I was really just interested as to why he would need to do something like that :slight_smile:


#6

@joe I wasn’t actually running that code, but it was a concise way to report and test the problem. What I was really doing is having my webpage call a service that ran SQL and trying to merge the timings together (similar to how the WCF code in MiniProfiler works).