-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Bug in NHibernate.CFg.Configuration.cs
PostPosted: Mon Mar 27, 2006 9:23 am 
Regular
Regular

Joined: Mon Mar 20, 2006 10:49 pm
Posts: 59
Method AddDirectory doesn't work if it's not the current directory. The fix is to change the line

AddFile( hbmXml.Name )
to
AddFile( hbmXml.FullName )
or (using a different AddFile overload)
AddFile( hbmXml )

BTW, in CLR 2.0, there is a new overload of DirectoryInfo.GetFiles that searches the entire subtree, thus eliminating the need for the recursive loop in AddDirectory.

I have copied the original version of AddDirectory below.

Mike Abraham


Code:
      /// <summary>
      /// Read all mapping documents from a directory tree. Assume that any
      /// file named <c>*.hbm.xml</c> is a mapping document.
      /// </summary>
      /// <param name="dir">a directory</param>
      public Configuration AddDirectory( DirectoryInfo dir )
      {
         foreach( DirectoryInfo subDirectory in dir.GetDirectories() )
         {
            AddDirectory( subDirectory );
         }

         foreach( FileInfo hbmXml in dir.GetFiles( "*.hbm.xml" ) )
         {
            AddFile( hbmXml.Name );
         }

         return this;
      }

_________________
Mike Abraham


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 27, 2006 5:00 pm 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
Yes, this will be fixed in the next release.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.