Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Impl
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22676/NHibernate/Impl
Modified Files:
SessionFactoryImpl.cs
Log Message:
Fixed up interface to GetPersister(string) so it behaives just like h2.0.3 -
added an overload to allows the caller to control wether or not throw an
exception and instead return null
Index: SessionFactoryImpl.cs
===================================================================
RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Impl/SessionFactoryImpl.cs,v
retrieving revision 1.29
retrieving revision 1.30
diff -C2 -d -r1.29 -r1.30
*** SessionFactoryImpl.cs 31 Aug 2004 13:14:25 -0000 1.29
--- SessionFactoryImpl.cs 13 Sep 2004 04:47:44 -0000 1.30
***************
*** 517,525 ****
public IClassPersister GetPersister(string className)
{
! //(IClassPersister) was replaced by as
IClassPersister result = classPersistersByName[className] as IClassPersister;
! //TODO: not throwing this exception results in a 50% perf gain with hql - not sure
! // where else this code is being used and expecting an exception...
! // if ( result==null) throw new MappingException( "No persister for: " + className );
return result;
}
--- 517,531 ----
public IClassPersister GetPersister(string className)
{
! return GetPersister( className, true );
! }
!
! public IClassPersister GetPersister(string className, bool throwException)
! {
IClassPersister result = classPersistersByName[className] as IClassPersister;
!
! if ( result==null && throwException )
! {
! throw new MappingException( "No persister for: " + className );
! }
return result;
}
***************
*** 527,531 ****
public IClassPersister GetPersister(System.Type theClass)
{
- //IClassPersister result = (IClassPersister) classPersisters[theClass];
IClassPersister result = classPersisters[theClass] as IClassPersister;
if ( result==null) throw new MappingException( "No persisters for: " + theClass.FullName );
--- 533,536 ----
***************
*** 535,539 ****
public CollectionPersister GetCollectionPersister(string role)
{
- //CollectionPersister result = (CollectionPersister) collectionPersisters[role];
CollectionPersister result = collectionPersisters[role] as CollectionPersister;
if ( result==null ) throw new MappingException( "No persisters for collection role: " + role );
--- 540,543 ----
|