views:

26

answers:

1

I used NHibernate 2.1.2 and FluentNhibernate 1.1, database SQLITE In Memory (For unit testing purposes). Purposes of interceptor is to make proxy object returned by create criteria. I think i already register the interceptor to configuration correctly. but create criteria only return the naked object not proxied at all. I tried to put a breakpoint on the interceptor Instantiate method but process didn't stop there.

So my question:

How to know weather my interceptor is already setup correctly or not. Maybe can it be done using log? but i having problem to using configuration in visual studio unit testing.

Best Regards

A: 

OK, i spent 12 hours because of trivial problem.

Interceptor didn't work for Issesion.Get

here is what i have been mistaken

public UserModel Save(UserModel user)
{
    UserModel result = null;
    using (ITransaction transaction = session.BeginTransaction())
    {
        var id = session.Save(user);
        //here i expect a proxied UserModel will returned
        result = session.Get<UserModel>(id);
        transaction.Commit();
    }
    return result;
}

I realized that my interceptor work fine after i decided to just leave it and start to write unit test for GetUsers method which is using Criteria API.

FYI if you interesting on nhibernate interceptor, i found it here.

bonjorno