From: Michael D. <mik...@us...> - 2004-07-26 12:48:53
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Cfg In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30699/NHibernate/Cfg Modified Files: Configuration.cs Log Message: Added mapping for resource & assembly combination Index: Configuration.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Cfg/Configuration.cs,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** Configuration.cs 20 Jul 2004 13:52:52 -0000 1.18 --- Configuration.cs 26 Jul 2004 12:48:40 -0000 1.19 *************** *** 7,18 **** using System.Xml.Schema; - using NHibernate.Id; - using NHibernate.Impl; - using NHibernate.Util; - using NHibernate.Type; - using NHibernate.Mapping; using NHibernate.Cache; using NHibernate.Dialect; using NHibernate.Engine; namespace NHibernate.Cfg --- 7,18 ---- using System.Xml.Schema; using NHibernate.Cache; using NHibernate.Dialect; using NHibernate.Engine; + using NHibernate.Id; + using NHibernate.Impl; + using NHibernate.Mapping; + using NHibernate.Type; + using NHibernate.Util; namespace NHibernate.Cfg *************** *** 31,35 **** /// </para> /// </remarks> ! public class Configuration : IMapping { private static readonly log4net.ILog log = log4net.LogManager.GetLogger(typeof(Configuration)); --- 31,36 ---- /// </para> /// </remarks> ! public class Configuration : IMapping ! { private static readonly log4net.ILog log = log4net.LogManager.GetLogger(typeof(Configuration)); *************** *** 293,297 **** /// <remarks> /// The Assembly must be in the local bin, probing path, or GAC so that the ! /// Assembly can be loaded by name. /// </remarks> public Configuration AddAssembly(string assemblyName) --- 294,300 ---- /// <remarks> /// The Assembly must be in the local bin, probing path, or GAC so that the ! /// Assembly can be loaded by name. If these conditions are not satisfied ! /// then your code should load the Assembly and call the override <see cref="AddAssembly(Assembly)"/> ! /// instead. /// </remarks> public Configuration AddAssembly(string assemblyName) *************** *** 309,312 **** --- 312,326 ---- throw new MappingException(e); } + + return this.AddAssembly(assembly); + } + + /// <summary> + /// Adds all of the Assembly's Resource files that end with "hbm.xml" + /// </summary> + /// <param name="assembly">The loaded Assembly.</param> + /// <returns>This Configuration object.</returns> + public Configuration AddAssembly(Assembly assembly) + { foreach(string fileName in assembly.GetManifestResourceNames() ) { *************** *** 329,335 **** --- 343,351 ---- } } + return this; } + private ICollection CollectionGenerators(Dialect.Dialect dialect) { *************** *** 719,728 **** if (rsrc!=null) { ! log.Debug(name + "<-" + rsrc); ! AddResource( rsrc.Value, Assembly.GetExecutingAssembly() ); } else if ( assembly!=null) { ! log.Debug(name + "<-" + assembly); AddAssembly(assembly.Value); } --- 735,744 ---- if (rsrc!=null) { ! log.Debug( name.Value + "<-" + rsrc.Value + " in " + assembly.Value ); ! AddResource( rsrc.Value, Assembly.Load( assembly.Value ) ); } else if ( assembly!=null) { ! log.Debug( name.Value + "<-" + assembly.Value ); AddAssembly(assembly.Value); } *************** *** 730,734 **** { if (file==null) throw new MappingException("<mapping> element in configuration specifies no attributes"); ! log.Debug(name + "<-" + file); AddXmlFile( file.Value ); } --- 746,750 ---- { if (file==null) throw new MappingException("<mapping> element in configuration specifies no attributes"); ! log.Debug( name.Value + "<-" + file.Value ); AddXmlFile( file.Value ); } *************** *** 736,740 **** } ! log.Info("Configured SessionFactory: " + name); log.Debug("properties: " + properties); --- 752,756 ---- } ! log.Info("Configured SessionFactory: " + name.Value); log.Debug("properties: " + properties); |