@@ -465,14 +465,10 @@ public ISession OpenSession(IDbConnection connection, bool flushBeforeCompletion
465
465
466
466
public IEntityPersister GetEntityPersister ( string entityName )
467
467
{
468
- try
469
- {
470
- return entityPersisters [ entityName ] ;
471
- }
472
- catch ( KeyNotFoundException )
473
- {
474
- throw new MappingException ( "No persister for: " + entityName ) ;
475
- }
468
+ IEntityPersister value ;
469
+ if ( entityPersisters . TryGetValue ( entityName , out value ) == false )
470
+ throw new MappingException ( "No persister for: " + entityName ) ;
471
+ return value ;
476
472
}
477
473
478
474
public IEntityPersister TryGetEntityPersister ( string entityName )
@@ -484,14 +480,10 @@ public IEntityPersister TryGetEntityPersister(string entityName)
484
480
485
481
public ICollectionPersister GetCollectionPersister ( string role )
486
482
{
487
- try
488
- {
489
- return collectionPersisters [ role ] ;
490
- }
491
- catch ( KeyNotFoundException )
492
- {
483
+ ICollectionPersister value ;
484
+ if ( collectionPersisters . TryGetValue ( role , out value ) == false )
493
485
throw new MappingException ( "Unknown collection role: " + role ) ;
494
- }
486
+ return value ;
495
487
}
496
488
497
489
public ISet < string > GetCollectionRolesByEntityParticipant ( string entityName )
@@ -979,14 +971,10 @@ public ResultSetMappingDefinition GetResultSetMapping(string resultSetName)
979
971
980
972
public FilterDefinition GetFilterDefinition ( string filterName )
981
973
{
982
- try
983
- {
984
- return filters [ filterName ] ;
985
- }
986
- catch ( KeyNotFoundException )
987
- {
974
+ FilterDefinition value ;
975
+ if ( filters . TryGetValue ( filterName , out value ) == false )
988
976
throw new HibernateException ( "No such filter configured [" + filterName + "]" ) ;
989
- }
977
+ return value ;
990
978
}
991
979
992
980
public ICollection < string > DefinedFilterNames
0 commit comments