*sigh*
Sergey, you were, of course, correct. I was seeing proxies and the reason they weren't working was that I'd missed settgin a property in a superclass to virtual.
I'm interested, though, in how to use an interface as a proxy rather than having to make all these properties virtual. I'd really prefer to have sealed classes.
When I try to use an interface as a proxy I'm getting an error when trying to build a SessionFactory:
Code:
NHibernate.Impl.SessionFactoryImpl: 2005-09-12 10:18:48,672 [5788] DEBUG NHibernate.Impl.SessionFactoryImpl [(null)] <(null)> - instantiating session factory with properties: {hibernate.dialect=NHibernate.Dialect.MsSql2000Dialect, hibernate.query.substitutions=true 1, false 0, hibernate.connection.connection_string=Data source=SROTTEM\VSDotNet;Initial Catalog=Papa.Framework;User Id=sa;Password=sqladmin, hibernate.connection.provider=NHibernate.Connection.DriverConnectionProvider, hibernate.connection.driver_class=NHibernate.Driver.SqlClientDriver}
Object reference not set to an instance of an object.
at NHibernate.PropertyNotFoundException..ctor(Type type, String fieldName)
at NHibernate.Property.FieldAccessor.GetField(Type type, String fieldName)
at NHibernate.Property.FieldAccessor.GetField(Type type, String fieldName)
at NHibernate.Property.FieldAccessor.GetGetter(Type theClass, String propertyName)
at NHibernate.Mapping.Property.GetGetter(Type clazz)
at NHibernate.Persister.AbstractEntityPersister..ctor(PersistentClass model, ISessionFactoryImplementor factory)
at NHibernate.Persister.EntityPersister..ctor(PersistentClass model, ISessionFactoryImplementor factory)
at NHibernate.Persister.PersisterFactory.CreateClassPersister(PersistentClass model, ISessionFactoryImplementor factory)
at NHibernate.Impl.SessionFactoryImpl..ctor(Configuration cfg, Settings settings)
at NHibernate.Cfg.Configuration.BuildSessionFactory()
at Papa.Framework.Core.Repository..ctor(String dbConnectionString) in C:\Documents and Settings\Symon\My Documents\Visual Studio Projects\Xpedite\PAPA\Papa.Framework.Core\Repository.cs:line 79
at Papa.Framework.Core.Tests.FullPrivilegeTestCase.TestFixtureSetup() in C:\Documents and Settings\Symon\My Documents\Visual Studio Projects\Xpedite\PAPA\Papa.Framework.Tests\FullPrivilegeTestCase.cs:line 117
I've just added a proxy attribute to the class referring to the interface for the object.
Any thoughts?
Cheers,
Symon.