Disable for specific session

0 views
Skip to first unread message

Emad Ibrahim

unread,
Dec 24, 2009, 8:09:55 AM12/24/09
to nhprof
I am using nhprof in unit testing and I want to disable it from
listenting to a specific session... For example, when I test my
repository, I have a method that populates my database with some dummy
test data... Something like

private void CreateInitialData()
{
using (ISession session = SessionFactory.OpenSession())
{
using (ITransaction transaction =
session.BeginTransaction())
{
foreach (var city in _cities)
session.Save(city);

transaction.Commit();
}
}
}

How do I tell nhprof not to listen to this session?

Ayende Rahien

unread,
Dec 24, 2009, 10:23:42 AM12/24/09
to nhp...@googlegroups.com
There isn't a real way of doing that.
A simple work around would be:

HttpContext.Current = new HttpContext("this is a url to ignore"); // not the real syntax for creating it.
// use the session
HttpContext.Current = null;

Then setup filtering in NH Prof for filtering out sessions with this url.


--

You received this message because you are subscribed to the Google Groups "nhprof" group.
To post to this group, send email to nhp...@googlegroups.com.
To unsubscribe from this group, send email to nhprof+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/nhprof?hl=en.



Reply all
Reply to author
Forward
0 new messages