Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Cfg
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4705/NHibernate/Cfg
Modified Files:
Configuration.cs Environment.cs
Log Message:
Fixed problem where Config.Configure() was overwriting
Environment.properties because a reference to the IDictionary was being
returned, not a copy of the keys/values.
Index: Configuration.cs
===================================================================
RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Cfg/Configuration.cs,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** Configuration.cs 12 Jul 2004 02:26:28 -0000 1.17
--- Configuration.cs 20 Jul 2004 13:52:52 -0000 1.18
***************
*** 1,9 ****
using System;
using System.IO;
using System.Xml;
using System.Xml.Schema;
- using System.Reflection;
- using System.Collections;
using NHibernate.Id;
using NHibernate.Impl;
--- 1,10 ----
using System;
+ using System.Collections;
+ using System.Collections.Specialized;
using System.IO;
+ using System.Reflection;
using System.Xml;
using System.Xml.Schema;
using NHibernate.Id;
using NHibernate.Impl;
***************
*** 73,77 ****
mappingSchema = XmlSchema.Read(Assembly.GetExecutingAssembly().GetManifestResourceStream(MappingSchemaResource), null);
cfgSchema = XmlSchema.Read(Assembly.GetExecutingAssembly().GetManifestResourceStream(CfgSchemaResource), null);
-
}
--- 74,77 ----
***************
*** 130,137 ****
try
{
! AddXmlReader(new XmlTextReader(xmlFile));
! // XmlDocument doc = new XmlDocument();
! // doc.Load(xmlFile);
! // Add ( doc );
}
catch (Exception e)
--- 130,134 ----
try
{
! AddXmlReader( new XmlTextReader(xmlFile) );
}
catch (Exception e)
***************
*** 153,165 ****
try
{
-
// make a StringReader for the string passed in - the StringReader
// inherits from TextReader. We can use the XmlTextReader.ctor that
// takes the TextReader to build from a string...
! AddXmlReader(new XmlTextReader(new StringReader(xml)));
!
! // XmlDocument doc = new XmlDocument();
! // doc.LoadXml(xml);
! // Add ( doc );
}
catch (Exception e)
--- 150,157 ----
try
{
// make a StringReader for the string passed in - the StringReader
// inherits from TextReader. We can use the XmlTextReader.ctor that
// takes the TextReader to build from a string...
! AddXmlReader( new XmlTextReader(new StringReader(xml)) );
}
catch (Exception e)
***************
*** 180,185 ****
try
{
! AddXmlReader(new XmlNodeReader(doc));
! // Add ( doc );
}
catch (Exception e)
--- 172,176 ----
try
{
! AddXmlReader( new XmlNodeReader(doc) );
}
catch (Exception e)
***************
*** 201,205 ****
{
Binder.dialect = Dialect.Dialect.GetDialect(properties);
! Binder.BindRoot( doc, CreateMappings());
}
catch (MappingException me)
--- 192,196 ----
{
Binder.dialect = Dialect.Dialect.GetDialect(properties);
! Binder.BindRoot( doc, CreateMappings() );
}
catch (MappingException me)
***************
*** 228,236 ****
try
{
! AddXmlReader(new XmlTextReader(xmlInputStream));
!
! // XmlDocument doc = new XmlDocument();
! // doc.Load(xmlInputStream);
! // Add( doc );
return this;
}
--- 219,223 ----
try
{
! AddXmlReader( new XmlTextReader(xmlInputStream) );
return this;
}
Index: Environment.cs
===================================================================
RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Cfg/Environment.cs,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** Environment.cs 12 Jul 2004 01:28:50 -0000 1.14
--- Environment.cs 20 Jul 2004 13:52:52 -0000 1.15
***************
*** 1,7 ****
using System;
- using System.Xml;
using System.Collections;
using System.Collections.Specialized;
using System.Configuration;
using NHibernate.Util;
--- 1,7 ----
using System;
using System.Collections;
using System.Collections.Specialized;
using System.Configuration;
+ using System.Xml;
using NHibernate.Util;
***************
*** 84,90 ****
}
public static IDictionary Properties
{
! get { return properties; }
}
--- 84,104 ----
}
+ /// <summary>
+ /// Gets a copy of the configuration found in app.config/web.config
+ /// </summary>
+ /// <remarks>
+ /// This is the replacement for hibernate.properties
+ /// </remarks>
public static IDictionary Properties
{
! get
! {
! IDictionary copy = new Hashtable(properties.Count);
! foreach(DictionaryEntry de in properties)
! {
! copy[de.Key] = de.Value;
! }
! return copy;
! }
}
|