You can subscribe to this list here.
2004 |
Jan
|
Feb
|
Mar
|
Apr
(248) |
May
(82) |
Jun
(90) |
Jul
(177) |
Aug
(253) |
Sep
(157) |
Oct
(151) |
Nov
(143) |
Dec
(278) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2005 |
Jan
(152) |
Feb
(107) |
Mar
(177) |
Apr
(133) |
May
(259) |
Jun
(81) |
Jul
(119) |
Aug
(306) |
Sep
(416) |
Oct
(240) |
Nov
(329) |
Dec
(206) |
2006 |
Jan
(466) |
Feb
(382) |
Mar
(153) |
Apr
(162) |
May
(133) |
Jun
(21) |
Jul
(18) |
Aug
(37) |
Sep
(97) |
Oct
(114) |
Nov
(110) |
Dec
(28) |
2007 |
Jan
(74) |
Feb
(65) |
Mar
(49) |
Apr
(76) |
May
(43) |
Jun
(15) |
Jul
(68) |
Aug
(55) |
Sep
(63) |
Oct
(59) |
Nov
(70) |
Dec
(66) |
2008 |
Jan
(71) |
Feb
(60) |
Mar
(120) |
Apr
(31) |
May
(48) |
Jun
(81) |
Jul
(107) |
Aug
(51) |
Sep
(80) |
Oct
(83) |
Nov
(83) |
Dec
(79) |
2009 |
Jan
(83) |
Feb
(110) |
Mar
(97) |
Apr
(91) |
May
(291) |
Jun
(250) |
Jul
(197) |
Aug
(58) |
Sep
(54) |
Oct
(122) |
Nov
(68) |
Dec
(34) |
2010 |
Jan
(50) |
Feb
(17) |
Mar
(63) |
Apr
(61) |
May
(84) |
Jun
(81) |
Jul
(138) |
Aug
(144) |
Sep
(78) |
Oct
(26) |
Nov
(30) |
Dec
(61) |
2011 |
Jan
(33) |
Feb
(35) |
Mar
(166) |
Apr
(221) |
May
(109) |
Jun
(76) |
Jul
(27) |
Aug
(37) |
Sep
(1) |
Oct
(4) |
Nov
(2) |
Dec
(1) |
2012 |
Jan
|
Feb
|
Mar
(2) |
Apr
(2) |
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
(1) |
Oct
|
Nov
(1) |
Dec
|
2013 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
(1) |
Sep
(3) |
Oct
(2) |
Nov
|
Dec
(1) |
2014 |
Jan
(1) |
Feb
(1) |
Mar
(3) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Michael D. <mik...@us...> - 2005-02-21 19:46:37
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Id In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9074/NHibernate/Id Modified Files: SequenceHiLoGenerator.cs Log Message: NH-208: fixed problem casting between Int32 and Int64 Index: SequenceHiLoGenerator.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Id/SequenceHiLoGenerator.cs,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** SequenceHiLoGenerator.cs 15 Jan 2005 21:16:13 -0000 1.7 --- SequenceHiLoGenerator.cs 21 Feb 2005 19:45:49 -0000 1.8 *************** *** 80,84 **** if( lo > maxLo ) { ! long hival = ( ( long ) base.Generate( session, obj ) ); lo = 1; hi = hival*( maxLo + 1 ); --- 80,84 ---- if( lo > maxLo ) { ! long hival = Convert.ToInt64( base.Generate( session, obj ) ); lo = 1; hi = hival*( maxLo + 1 ); |
From: Michael D. <mik...@us...> - 2005-02-21 19:19:33
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Cfg In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2694/NHibernate/Cfg Modified Files: Configuration.cs Added Files: AssemblyHbmOrderer.cs Log Message: NH-178: AddAssembly now orders the hbm.xml files before processing. --- NEW FILE: AssemblyHbmOrderer.cs --- using System; using System.Collections; using System.Collections.Specialized; using System.IO; using System.Reflection; using System.Xml; namespace NHibernate.Cfg { /// <summary> /// Analyzes the contents of the <c>hbm.xml</c> files embedded in the /// <see cref="Assembly"/> for their dependency order. /// </summary> /// <remarks> /// This solves the problem caused when you have embedded <c>hbm.xml</c> files /// that contain subclasses/joined-subclasses that make use of the <c>extends</c> /// attribute. This ensures that those subclasses/joined-subclasses will not be /// processed until after the class they extend is processed. /// </remarks> internal class AssemblyHbmOrderer { /* * It almost seems like a better way to handle this would be to have * Binder.BindRoot throw a different exception when a subclass/joined-subclass * couldn't find their base class mapping. The AddAssembly method could * "queue" up the problem hbm.xml files and run through them at the end. * This method solves the problem WELL enough to get by with for now. */ Assembly _assembly; /// <summary> /// An unordered <see cref="IList"/> of all the mapped classes contained /// in the assembly. /// </summary> ArrayList _classes; /// <summary> /// An <see cref="IList"/> of all the <c>hbm.xml</c> resources found /// in the assembly. /// </summary> ArrayList _hbmResources; /// <summary> /// Creates a new instance of <see cref="AssemblyHbmOrderer"/> /// </summary> /// <param name="assembly">The <see cref="Assembly"/> to order the <c>hbm.xml</c> files in.</param> public AssemblyHbmOrderer(Assembly assembly) { _assembly = assembly; _classes = new ArrayList(); _hbmResources = new ArrayList(); foreach( string fileName in assembly.GetManifestResourceNames() ) { if( fileName.EndsWith( ".hbm.xml" ) ) { _hbmResources.Add( fileName ); } } } /// <summary> /// Gets an <see cref="IList"/> of <c>hbm.xml</c> resources in the correct order. /// </summary> /// <returns> /// An <see cref="IList"/> of <c>hbm.xml</c> resources in the correct order. /// </returns> public IList GetHbmFiles() { // tracks if any hbm.xml files make use of the "extends" attribute bool containsExtends = false; foreach( string fileName in _hbmResources ) { Stream xmlInputStream = null; XmlReader xmlReader = null; try { xmlInputStream = _assembly.GetManifestResourceStream( fileName ); xmlReader = new XmlTextReader( xmlInputStream ); while( xmlReader.Read() ) { if( xmlReader.NodeType!=XmlNodeType.Element ) { continue; } if( xmlReader.Name=="class" ) { xmlReader.MoveToAttribute("name"); string className = xmlReader.Value; ClassEntry ce = new ClassEntry( null, className, fileName ); _classes.Add(ce); } else if( xmlReader.Name=="joined-subclass" || xmlReader.Name=="subclass" ) { xmlReader.MoveToAttribute("name"); string className = xmlReader.Value; if( xmlReader.MoveToAttribute("extends") ) { containsExtends = true; string baseClassName = xmlReader.Value; ClassEntry ce = new ClassEntry( baseClassName, className, fileName ); _classes.Add(ce); } } } } finally { if( xmlReader!=null ) { xmlReader.Close(); } if( xmlInputStream!=null ) { xmlInputStream.Close(); } } } // only bother to do the sorting if one of the hbm files uses 'extends' - // the sorting does quite a bit of looping through collections so if we don't // need to spend the time doing that then don't bother. if( containsExtends ) { return OrderedHbmFiles( _classes ); } else { return _hbmResources; } } /// <summary> /// Returns an <see cref="IList"/> of <c>hbm.xml</c> files in the order that ensures /// base classes are loaded before their subclass/joined-subclass. /// </summary> /// <param name="unorderedClasses">An <see cref="IList"/> of <see cref="ClassEntry"/> objects.</param> /// <returns> /// An <see cref="IList"/> of <see cref="String"/> objects that contain the <c>hbm.xml</c> file names. /// </returns> private IList OrderedHbmFiles(IList unorderedClasses) { // Make sure joined-subclass mappings are loaded after base class ArrayList sortedList = new ArrayList(); foreach( ClassEntry ce in unorderedClasses ) { // this class extends nothing - so put it at the front of // the list because it is safe to process at any time. if( ce.BaseClassName==null ) { sortedList.Insert( 0, ce ); } else { int insertIndex = -1; // try to find this classes base class in the list already for( int i=0; i<sortedList.Count; i++ ) { ClassEntry sce = (ClassEntry)sortedList[i]; // base class was found - insert at the index // immediately following it if( sce.ClassName==ce.BaseClassName ) { insertIndex = i + 1; break; } } // This Classes' baseClass was not found in the list so we still don't // know where to insert it. Check to see if any of the classes that // have already been sorted derive from this class. if( insertIndex==-1 ) { for( int j=0; j<sortedList.Count; j++ ) { ClassEntry sce = (ClassEntry)sortedList[j]; // A class already in the sorted list derives from this class so // insert this class before the class deriving from it. if( sce.BaseClassName == ce.ClassName ) { insertIndex = j; break; } } } // could not find any classes that were subclasses of this one or // that this class was a subclass of so it should be inserted at // then end. if( insertIndex==-1 ) { // Insert at end insertIndex = sortedList.Count; } sortedList.Insert( insertIndex, ce ); } } // now that we know the order the classes should be loaded - order the // hbm.xml files those classes are contained in. StringCollection loadedFiles = new StringCollection(); foreach( ClassEntry ce in sortedList ) { // Check if this file already loaded (this can happen if // we have mappings for multiple classes in one file). if (loadedFiles.Contains( ce.FileName )==false ) { loadedFiles.Add( ce.FileName ); } } return loadedFiles; } /// <summary> /// Holds information about mapped classes found in the <c>hbm.xml</c> files. /// </summary> internal class ClassEntry { private string _baseClassName; private string _className; private string _fileName; public ClassEntry(string baseClassName, string className, string fileName) { _baseClassName = baseClassName; _className = className; _fileName = fileName; } /// <summary> /// Gets the name of the Class that this Class inherits from, or <c>null</c> /// if this does not inherit from any mapped Class. /// </summary> public string BaseClassName { get { return _baseClassName; } } /// <summary> /// Gets the name of this Class. /// </summary> public string ClassName { get { return _className; } } /// <summary> /// Gets the name of the <c>hbm.xml</c> file this class was found in. /// </summary> public string FileName { get { return _fileName; } } } } } Index: Configuration.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Cfg/Configuration.cs,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** Configuration.cs 21 Feb 2005 14:27:36 -0000 1.30 --- Configuration.cs 21 Feb 2005 19:17:39 -0000 1.31 *************** *** 148,152 **** /// creating Mapping objects from the Mapping Xml. /// </summary> ! /// <param name="doc">The validated XmlDocument that contains the Mappings.</param> private void Add( XmlDocument doc ) { --- 148,152 ---- /// creating Mapping objects from the Mapping Xml. /// </summary> ! /// <param name="doc">The <b>validated</b> XmlDocument that contains the Mappings.</param> private void Add( XmlDocument doc ) { *************** *** 197,203 **** /// <param name="assembly">The loaded Assembly.</param> /// <returns>This Configuration object.</returns> public Configuration AddAssembly( Assembly assembly ) { ! foreach( string fileName in assembly.GetManifestResourceNames() ) { if( fileName.EndsWith( ".hbm.xml" ) ) --- 197,245 ---- /// <param name="assembly">The loaded Assembly.</param> /// <returns>This Configuration object.</returns> + /// <remarks> + /// This assumes that the <c>hbm.xml</c> files in the Assembly need to be put + /// in the correct order by NHibernate. See <see cref="AddAssembly(Assembly, bool)"> + /// AddAssembly(Assembly assembly, bool skipOrdering)</see> + /// for the impacts and reasons for letting NHibernate order the + /// <c>hbm.xml</c> files. + /// </remarks> public Configuration AddAssembly( Assembly assembly ) { ! // assume ordering is needed because that is the ! // safest way to handle it. ! return AddAssembly( assembly, false ); ! } ! ! /// <summary> ! /// Adds all of the Assembly's Resource files that end with "hbm.xml" ! /// </summary> ! /// <param name="assembly">The loaded Assembly.</param> ! /// <param name="skipOrdering"> ! /// A <see cref="Boolean"/> indicating if the ordering of hbm.xml files can be skipped. ! /// </param> ! /// <returns>This Configuration object.</returns> ! /// <remarks> ! /// <p> ! /// The order of <c>hbm.xml</c> files only matters if the attribute "extends" is used. ! /// The ordering should only be done when needed because it takes extra time ! /// to read the Xml files to find out the order the files should be passed to the Binder. ! /// If you don't use the "extends" attribute then it is reccommended to call this ! /// with <c>skipOrdering=true</c>. ! /// </p> ! /// </remarks> ! public Configuration AddAssembly(Assembly assembly, bool skipOrdering) ! { ! IList resources = null; ! if( skipOrdering ) ! { ! resources = assembly.GetManifestResourceNames(); ! } ! else ! { ! AssemblyHbmOrderer orderer = new AssemblyHbmOrderer( assembly ); ! resources = orderer.GetHbmFiles(); ! } ! ! foreach( string fileName in resources ) { if( fileName.EndsWith( ".hbm.xml" ) ) |
From: Michael D. <mik...@us...> - 2005-02-21 19:19:08
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.Test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2694/NHibernate.Test Modified Files: NHibernate.Test-1.1.csproj Log Message: NH-178: AddAssembly now orders the hbm.xml files before processing. Index: NHibernate.Test-1.1.csproj =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/NHibernate.Test-1.1.csproj,v retrieving revision 1.63 retrieving revision 1.64 diff -C2 -d -r1.63 -r1.64 *** NHibernate.Test-1.1.csproj 11 Feb 2005 21:26:21 -0000 1.63 --- NHibernate.Test-1.1.csproj 21 Feb 2005 19:17:59 -0000 1.64 *************** *** 226,229 **** --- 226,234 ---- /> <File + RelPath = "CfgTest\HbmOrderingFixture.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "CompositeId\ClassWithCompositeId.cs" SubType = "Code" |
From: Michael D. <mik...@us...> - 2005-02-21 19:18:44
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2694/NHibernate Modified Files: NHibernate-1.1.csproj Log Message: NH-178: AddAssembly now orders the hbm.xml files before processing. Index: NHibernate-1.1.csproj =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/NHibernate-1.1.csproj,v retrieving revision 1.73 retrieving revision 1.74 diff -C2 -d -r1.73 -r1.74 *** NHibernate-1.1.csproj 14 Feb 2005 03:58:52 -0000 1.73 --- NHibernate-1.1.csproj 21 Feb 2005 19:17:45 -0000 1.74 *************** *** 365,368 **** --- 365,373 ---- /> <File + RelPath = "Cfg\AssemblyHbmOrderer.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "Cfg\Binder.cs" SubType = "Code" |
From: Michael D. <mik...@us...> - 2005-02-21 19:17:54
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/CfgTest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2694/NHibernate.Test/CfgTest Added Files: HbmOrderingFixture.cs Log Message: NH-178: AddAssembly now orders the hbm.xml files before processing. --- NEW FILE: HbmOrderingFixture.cs --- using System; using System.Reflection; using System.Reflection.Emit; using System.IO; using NHibernate.Cfg; using NUnit.Framework; namespace NHibernate.Test.CfgTest { #region Classes used by the mappings defined in the Dynamic Assembly public class A { public int Id { get { return id_; } set { id_ = value; } } private int id_; } public class B : A { public int Value { get { return value_; } set { value_ = value; } } private int value_; } public class C : B { public int Description { get { return description_; } set { description_ = value; } } private int description_; } #endregion /// <summary> /// Test fixture for NH-178 /// </summary> [TestFixture] public class HbmOrderingFixture { // Working directory private static string dir_; // Base class mapping private const string aJoinedHbmXml = @"<?xml version=""1.0"" encoding=""utf-8"" ?> <hibernate-mapping xmlns=""urn:nhibernate-mapping-2.0""> <class name=""NHibernate.Test.CfgTest.A, NHibernate.Test"" table=""A""> <id name=""Id""> <generator class=""assigned"" /> </id> </class> </hibernate-mapping>"; // Derived class mapping private const string bJoinedHbmXml = @"<?xml version=""1.0"" encoding=""utf-8"" ?> <hibernate-mapping xmlns=""urn:nhibernate-mapping-2.0""> <joined-subclass name=""NHibernate.Test.CfgTest.B, NHibernate.Test"" extends=""NHibernate.Test.CfgTest.A, NHibernate.Test"" table=""B""> <key column=""Id"" /> <property name=""Value"" type=""Int32"" /> </joined-subclass> </hibernate-mapping>"; // Add another level private const string cJoinedHbmXml = @"<?xml version=""1.0"" encoding=""utf-8"" ?> <hibernate-mapping xmlns=""urn:nhibernate-mapping-2.0""> <joined-subclass name=""NHibernate.Test.CfgTest.C, NHibernate.Test"" extends=""NHibernate.Test.CfgTest.B, NHibernate.Test"" table=""B""> <key column=""Id"" /> <property name=""Description"" type=""String"" /> </joined-subclass> </hibernate-mapping>"; private const string aSubclassHbmXml = @"<?xml version=""1.0"" encoding=""utf-8"" ?> <hibernate-mapping xmlns=""urn:nhibernate-mapping-2.0""> <class name=""NHibernate.Test.CfgTest.A, NHibernate.Test"" table=""A"" discriminator-value=""0""> <id name=""Id""> <generator class=""assigned"" /> </id> <discriminator column=""disc_col"" type=""Int32"" /> </class> </hibernate-mapping>"; // Derived class mapping private const string bSubclassHbmXml = @"<?xml version=""1.0"" encoding=""utf-8"" ?> <hibernate-mapping xmlns=""urn:nhibernate-mapping-2.0""> <joined-subclass name=""NHibernate.Test.CfgTest.B, NHibernate.Test"" extends=""NHibernate.Test.CfgTest.A, NHibernate.Test"" table=""B"" discriminator-value=""1""> <key column=""Id"" /> <property name=""Value"" type=""Int32"" /> </joined-subclass> </hibernate-mapping>"; // Add another level private const string cSubclassHbmXml = @"<?xml version=""1.0"" encoding=""utf-8"" ?> <hibernate-mapping xmlns=""urn:nhibernate-mapping-2.0""> <joined-subclass name=""NHibernate.Test.CfgTest.C, NHibernate.Test"" extends=""NHibernate.Test.CfgTest.B, NHibernate.Test"" table=""B"" discriminator-value=""2""> <key column=""Id"" /> <property name=""Description"" type=""String"" /> </joined-subclass> </hibernate-mapping>"; #region NUnit.Framework.TestFixture Members [TestFixtureSetUp] public void TestFixtureSetUp() { dir_ = Directory.GetCurrentDirectory(); // Create hbm files (ideally, we could just embed them directly into the // assembly - same as VS does when 'Build Action' = 'Embedded Resource' - but // I could not find a way to do this, so we use files instead) StreamWriter aw = new StreamWriter( "A.hbm.xml" ); aw.Write( aJoinedHbmXml ); aw.Close(); StreamWriter bw = new StreamWriter( "B.hbm.xml" ); bw.Write( bJoinedHbmXml ); bw.Close(); StreamWriter cw = new StreamWriter( "C.hbm.xml" ); cw.Write( cJoinedHbmXml ); cw.Close(); StreamWriter asw = new StreamWriter( "A.subclass.hbm.xml" ); asw.Write( aJoinedHbmXml ); asw.Close(); StreamWriter bsw = new StreamWriter( "B.subclass.hbm.xml" ); bsw.Write( bJoinedHbmXml ); bsw.Close(); StreamWriter csw = new StreamWriter( "C.subclass.hbm.xml" ); csw.Write( cJoinedHbmXml ); csw.Close(); } [SetUp] public virtual void SetUp() { } [TearDown] public virtual void TearDown() { } [TestFixtureTearDown] public virtual void TestFixtureTearDown() { } #endregion [Test] public void TopDownJoined() { AssemblyName assemblyName = new AssemblyName(); assemblyName.Name = "MyTestA.dll"; AssemblyBuilder assemblyBuilder = AppDomain.CurrentDomain.DefineDynamicAssembly(assemblyName, AssemblyBuilderAccess.RunAndSave); ModuleBuilder moduleBuilder = assemblyBuilder.DefineDynamicModule(assemblyName.Name, assemblyName.Name, true); assemblyBuilder.AddResourceFile("A.hbm.xml", "A.hbm.xml"); assemblyBuilder.AddResourceFile("B.hbm.xml", "B.hbm.xml"); assemblyBuilder.AddResourceFile("C.hbm.xml", "C.hbm.xml"); assemblyBuilder.Save(assemblyName.Name); Configuration cfg = new Configuration(); cfg.AddAssembly( Assembly.LoadFile(dir_ + "/" + assemblyName.Name) ); // if no exception, success } [Test] public void BottomUpJoined() { AssemblyName assemblyName = new AssemblyName(); assemblyName.Name = "MyTestB.dll"; AssemblyBuilder assemblyBuilder = AppDomain.CurrentDomain.DefineDynamicAssembly(assemblyName, AssemblyBuilderAccess.RunAndSave); ModuleBuilder moduleBuilder = assemblyBuilder.DefineDynamicModule(assemblyName.Name, assemblyName.Name, true); assemblyBuilder.AddResourceFile("C.hbm.xml", "C.hbm.xml"); assemblyBuilder.AddResourceFile("B.hbm.xml", "B.hbm.xml"); assemblyBuilder.AddResourceFile("A.hbm.xml", "A.hbm.xml"); assemblyBuilder.Save(assemblyName.Name); Configuration cfg = new Configuration(); cfg.AddAssembly( Assembly.LoadFile(dir_ + "/" + assemblyName.Name) ); // if no exception, success } [Test] public void MixedJoined() { AssemblyName assemblyName = new AssemblyName(); assemblyName.Name = "MyTestC.dll"; AssemblyBuilder assemblyBuilder = AppDomain.CurrentDomain.DefineDynamicAssembly(assemblyName, AssemblyBuilderAccess.RunAndSave); ModuleBuilder moduleBuilder = assemblyBuilder.DefineDynamicModule(assemblyName.Name, assemblyName.Name, true); assemblyBuilder.AddResourceFile("B.hbm.xml", "B.hbm.xml"); assemblyBuilder.AddResourceFile("A.hbm.xml", "A.hbm.xml"); assemblyBuilder.AddResourceFile("C.hbm.xml", "C.hbm.xml"); assemblyBuilder.Save(assemblyName.Name); Configuration cfg = new Configuration(); cfg.AddAssembly( Assembly.LoadFile(dir_ + "/" + assemblyName.Name) ); // if no exception, success } [Test] public void MixedSubclass() { AssemblyName assemblyName = new AssemblyName(); assemblyName.Name = "MyTestCSubclass.dll"; AssemblyBuilder assemblyBuilder = AppDomain.CurrentDomain.DefineDynamicAssembly(assemblyName, AssemblyBuilderAccess.RunAndSave); ModuleBuilder moduleBuilder = assemblyBuilder.DefineDynamicModule(assemblyName.Name, assemblyName.Name, true); assemblyBuilder.AddResourceFile("B.subclass.hbm.xml", "B.hbm.xml"); assemblyBuilder.AddResourceFile("A.subclass.hbm.xml", "A.hbm.xml"); assemblyBuilder.AddResourceFile("C.subclass.hbm.xml", "C.hbm.xml"); assemblyBuilder.Save(assemblyName.Name); Configuration cfg = new Configuration(); cfg.AddAssembly( Assembly.LoadFile(dir_ + "/" + assemblyName.Name) ); // if no exception, success } } } |
From: Michael D. <mik...@us...> - 2005-02-21 14:27:45
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Cfg In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21222/src/NHibernate/Cfg Modified Files: Configuration.cs Log Message: NH-207: readers clean up after themselves. Index: Configuration.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Cfg/Configuration.cs,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** Configuration.cs 14 Feb 2005 03:29:05 -0000 1.29 --- Configuration.cs 21 Feb 2005 14:27:36 -0000 1.30 *************** *** 61,65 **** private static XmlNamespaceManager CfgNamespaceMgr; ! /// <summary></summary> protected void Reset() { --- 61,67 ---- private static XmlNamespaceManager CfgNamespaceMgr; ! /// <summary> ! /// Clear the internal state of the <see cref="Configuration"/> object. ! /// </summary> protected void Reset() { *************** *** 134,179 **** /// <summary> ! /// Adds the Mappings contained in the file specified. /// </summary> ! /// <param name="xmlFile">The name of the file (url or file system) that contains the Xml.</param> /// <returns>This Configuration object.</returns> ! public Configuration AddXmlFile( string xmlFile ) { ! log.Debug( "Mapping file: " + xmlFile ); try { ! AddXmlReader( new XmlTextReader( xmlFile ) ); } catch( Exception e ) { ! log.Error( "Could not configure datastore from file: " + xmlFile, e ); ! throw new MappingException( e ); } return this; } /// <summary> ! /// Adds the Mappings from a <c>String</c> /// </summary> ! /// <param name="xml">A string that contains the Mappings for the Xml</param> /// <returns>This Configuration object.</returns> ! public Configuration AddXmlString( string xml ) { ! if( log.IsDebugEnabled ) { ! log.Debug( "Mapping XML:\n" + xml ); } ! 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 ) { ! log.Error( "Could not configure datastore from XML", e ); } - return this; } --- 136,264 ---- /// <summary> ! /// Create a new <c>Mappings</c> to add classes and collection mappings to /// </summary> ! /// <returns></returns> ! public Mappings CreateMappings() ! { ! return new Mappings( classes, collections, tables, namedQueries, imports, caches, secondPasses ); ! } ! ! /// <summary> ! /// Takes the validated XmlDocument and has the Binder do its work of ! /// creating Mapping objects from the Mapping Xml. ! /// </summary> ! /// <param name="doc">The validated XmlDocument that contains the Mappings.</param> ! private void Add( XmlDocument doc ) ! { ! try ! { ! Binder.dialect = Dialect.Dialect.GetDialect( properties ); ! Binder.BindRoot( doc, CreateMappings() ); ! } ! catch( MappingException me ) ! { ! log.Error( "Could not compile the mapping document", me ); ! throw; ! } ! } ! ! /// <summary> ! /// Adds all of the Assembly's Resource files that end with "<c>hbm.xml</c>" ! /// </summary> ! /// <param name="assemblyName">The name of the Assembly to load.</param> /// <returns>This Configuration object.</returns> ! /// <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 ) { ! log.Info( "searching for mapped documents in assembly: " + assemblyName ); ! ! Assembly assembly = null; try { ! assembly = Assembly.Load( assemblyName ); } catch( Exception e ) { ! log.Error( "Could not configure datastore from assembly", e ); ! throw new MappingException( "Could not add assembly named: " + assemblyName, 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() ) + { + if( fileName.EndsWith( ".hbm.xml" ) ) + { + log.Info( "Found mapping documents in assembly: " + fileName ); + Stream resourceStream = null; + try + { + resourceStream = assembly.GetManifestResourceStream( fileName ); + AddInputStream( resourceStream ); + } + catch( MappingException ) + { + throw; + } + catch( Exception e ) + { + log.Error( "Could not configure datastore from assembly", e ); + throw new MappingException( e ); + } + finally + { + if( resourceStream!=null ) + { + resourceStream.Close(); + } + + } + } + } + return this; } /// <summary> ! /// Adds the Class' Mapping by appending an ".hbm.xml" to the end of the Full Class Name ! /// and looking in the Class' Assembly. /// </summary> ! /// <param name="persistentClass">The Type to Map.</param> /// <returns>This Configuration object.</returns> ! /// <remarks> ! /// If the Mappings and Classes are defined in different Assemblies or don't follow ! /// the same naming convention then this can not be used. ! /// </remarks> ! public Configuration AddClass( System.Type persistentClass ) { ! string fileName = persistentClass.FullName + ".hbm.xml"; ! log.Info( "Mapping resource: " + fileName ); ! Stream rsrc = persistentClass.Assembly.GetManifestResourceStream( fileName ); ! if( rsrc==null ) { ! throw new MappingException( "Resource: " + fileName + " not found" ); } ! ! try { ! return AddInputStream( rsrc ); } ! finally { ! rsrc.Close(); } } *************** *** 185,188 **** --- 270,275 ---- public Configuration AddDocument( XmlDocument doc ) { + XmlNodeReader nodeReader = null; + if( log.IsDebugEnabled ) { *************** *** 191,195 **** try { ! AddXmlReader( new XmlNodeReader( doc ) ); } catch( Exception e ) --- 278,284 ---- try { ! nodeReader = new XmlNodeReader( doc ); ! AddXmlReader( nodeReader ); ! return this; } catch( Exception e ) *************** *** 198,242 **** throw new MappingException( e ); } ! return this; ! } ! ! /// <summary> ! /// Takes the validated XmlDocument and has the Binder do its work of ! /// creating Mapping objects from the Mapping Xml. ! /// </summary> ! /// <param name="doc">The validated XmlDocument that contains the Mappings.</param> ! private void Add( XmlDocument doc ) ! { ! try ! { ! Binder.dialect = Dialect.Dialect.GetDialect( properties ); ! Binder.BindRoot( doc, CreateMappings() ); ! } ! catch( MappingException me ) { ! log.Error( "Could not compile the mapping document", me ); ! throw; } } /// <summary> - /// Create a new <c>Mappings</c> to add classes and collection mappings to - /// </summary> - /// <returns></returns> - public Mappings CreateMappings() - { - return new Mappings( classes, collections, tables, namedQueries, imports, caches, secondPasses ); - } - - /// <summary> /// Adds the Xml Mappings from the Stream. /// </summary> /// <param name="xmlInputStream">The Stream to read Xml from.</param> /// <returns>This Configuration object.</returns> public Configuration AddInputStream( Stream xmlInputStream ) { try { ! AddXmlReader( new XmlTextReader( xmlInputStream ) ); return this; } --- 287,314 ---- throw new MappingException( e ); } ! finally { ! nodeReader.Close(); } } /// <summary> /// Adds the Xml Mappings from the Stream. /// </summary> /// <param name="xmlInputStream">The Stream to read Xml from.</param> /// <returns>This Configuration object.</returns> + /// <remarks> + /// The <see cref="Stream"/> passed in through the parameter <c>xmlInputStream</c> + /// is not <b>guaranteed</b> to be cleaned up by this method. It is the callers responsiblity to + /// ensure that the <c>xmlInputStream</c> is properly handled when this method + /// completes. + /// </remarks> public Configuration AddInputStream( Stream xmlInputStream ) { + XmlTextReader textReader = null; try { ! textReader = new XmlTextReader( xmlInputStream ); ! AddXmlReader( textReader ); return this; } *************** *** 250,272 **** throw new MappingException( e ); } ! } ! ! /// <summary> ! /// Adds the Mappings in the XmlReader after validating it against the ! /// nhibernate-mapping-2.0 schema. ! /// </summary> ! /// <param name="hbmReader">The XmlReader that contains the mapping.</param> ! /// <returns>This Configuration object.</returns> ! public Configuration AddXmlReader( XmlReader hbmReader ) ! { ! XmlValidatingReader validatingReader = new XmlValidatingReader( hbmReader ); ! validatingReader.ValidationType = ValidationType.Schema; ! validatingReader.Schemas.Add( mappingSchema ); ! ! XmlDocument hbmDocument = new XmlDocument(); ! hbmDocument.Load( validatingReader ); ! Add( hbmDocument ); ! ! return this; } --- 322,332 ---- throw new MappingException( e ); } ! finally ! { ! if( textReader!=null ) ! { ! textReader.Close(); ! } ! } } *************** *** 281,374 **** log.Info( "mapping resource: " + path ); Stream rsrc = assembly.GetManifestResourceStream( path ); ! if( rsrc == null ) { throw new MappingException( "Resource: " + path + " not found" ); } ! return AddInputStream( rsrc ); } /// <summary> ! /// Adds the Class' Mapping by appending an ".hbm.xml" to the end of the Full Class Name ! /// and looking in the Class' Assembly. /// </summary> ! /// <param name="persistentClass">The Type to Map.</param> /// <returns>This Configuration object.</returns> ! /// <remarks> ! /// If the Mappings and Classes are defined in different Assemblies or don't follow ! /// the same naming convention then this can not be used. ! /// </remarks> ! public Configuration AddClass( System.Type persistentClass ) { ! string fileName = persistentClass.FullName + ".hbm.xml"; ! log.Info( "Mapping resource: " + fileName ); ! Stream rsrc = persistentClass.Assembly.GetManifestResourceStream( fileName ); ! if( rsrc == null ) { ! throw new MappingException( "Resource: " + fileName + " not found" ); } ! return AddInputStream( rsrc ); } /// <summary> ! /// Adds all of the Assembly's Resource files that end with "hbm.xml" /// </summary> ! /// <param name="assemblyName">The name of the Assembly to load.</param> /// <returns>This Configuration object.</returns> ! /// <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 ) { - log.Info( "searching for mapped documents in assembly: " + assemblyName ); ! Assembly assembly = null; ! try { ! assembly = Assembly.Load( assemblyName ); } ! catch( Exception e ) { ! log.Error( "Could not configure datastore from assembly", e ); ! throw new MappingException( "Could not add assembly named: " + assemblyName, 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() ) { ! if( fileName.EndsWith( ".hbm.xml" ) ) ! { ! log.Info( "Found mapping documents in assembly: " + fileName ); ! try ! { ! AddInputStream( assembly.GetManifestResourceStream( fileName ) ); ! } ! catch( MappingException ) ! { ! throw; ! } ! catch( Exception e ) ! { ! log.Error( "Could not configure datastore from assembly", e ); ! throw new MappingException( e ); ! } ! } } - return this; } - private ICollection CollectionGenerators( Dialect.Dialect dialect ) { --- 341,447 ---- log.Info( "mapping resource: " + path ); Stream rsrc = assembly.GetManifestResourceStream( path ); ! if( rsrc==null ) { throw new MappingException( "Resource: " + path + " not found" ); } ! ! try ! { ! return AddInputStream( rsrc ); ! } ! finally ! { ! if( rsrc!=null ) ! { ! rsrc.Close(); ! } ! } } /// <summary> ! /// Adds the Mappings contained in the file specified. /// </summary> ! /// <param name="xmlFile">The name of the file (url or file system) that contains the Xml.</param> /// <returns>This Configuration object.</returns> ! public Configuration AddXmlFile( string xmlFile ) { ! log.Debug( "Mapping file: " + xmlFile ); ! XmlTextReader textReader = null; ! try { ! textReader = new XmlTextReader( xmlFile ); ! AddXmlReader( textReader ); } ! catch( Exception e ) ! { ! log.Error( "Could not configure datastore from file: " + xmlFile, e ); ! throw new MappingException( e ); ! } ! finally ! { ! if( textReader!=null ) ! { ! textReader.Close(); ! } ! } ! return this; } /// <summary> ! /// Adds the Mappings in the XmlReader after validating it against the ! /// nhibernate-mapping-2.0 schema. /// </summary> ! /// <param name="hbmReader">The XmlReader that contains the mapping.</param> /// <returns>This Configuration object.</returns> ! public Configuration AddXmlReader( XmlReader hbmReader ) { ! XmlValidatingReader validatingReader = null; ! try { ! validatingReader = new XmlValidatingReader( hbmReader ); ! validatingReader.ValidationType = ValidationType.Schema; ! validatingReader.Schemas.Add( mappingSchema ); ! ! XmlDocument hbmDocument = new XmlDocument(); ! hbmDocument.Load( validatingReader ); ! Add( hbmDocument ); ! ! return this; } ! finally { ! if( validatingReader!=null ) ! { ! validatingReader.Close(); ! } } } /// <summary> ! /// Adds the Mappings from a <c>String</c> /// </summary> ! /// <param name="xml">A string that contains the Mappings for the Xml</param> /// <returns>This Configuration object.</returns> ! public Configuration AddXmlString( string xml ) { ! if( log.IsDebugEnabled ) { ! log.Debug( "Mapping XML:\n" + xml ); ! } ! 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 ) ! { ! log.Error( "Could not configure datastore from XML", e ); } return this; } private ICollection CollectionGenerators( Dialect.Dialect dialect ) { *************** *** 602,606 **** } ! /// <summary></summary> public IInterceptor Interceptor { --- 675,682 ---- } ! /// <summary> ! /// Gets or sets the <see cref="IInterceptor"/> to use. ! /// </summary> ! /// <value>The <see cref="IInterceptor"/> to use.</value> public IInterceptor Interceptor { *************** *** 609,613 **** } ! /// <summary></summary> public IDictionary Properties { --- 685,696 ---- } ! /// <summary> ! /// Gets or sets the <see cref="IDictionary"/> that contains the configuration ! /// Properties and their values. ! /// </summary> ! /// <value> ! /// The <see cref="IDictionary"/> that contains the configuration ! /// Properties and their values. ! /// </value> public IDictionary Properties { *************** *** 617,624 **** /// <summary> ! /// /// </summary> ! /// <param name="properties"></param> ! /// <returns></returns> public Configuration AddProperties( IDictionary properties ) { --- 700,711 ---- /// <summary> ! /// Adds an <see cref="IDictionary"/> of configuration properties. The ! /// Key is the name of the Property and the Value is the <see cref="String"/> ! /// value of the Property. /// </summary> ! /// <param name="properties">An <see cref="IDictionary"/> of configuration properties.</param> ! /// <returns> ! /// This <see cref="Configuration"/> object. ! /// </returns> public Configuration AddProperties( IDictionary properties ) { *************** *** 631,639 **** /// <summary> ! /// /// </summary> ! /// <param name="name"></param> ! /// <param name="value"></param> ! /// <returns></returns> public Configuration SetProperty( string name, string value ) { --- 718,728 ---- /// <summary> ! /// Sets the value of the configuration property. /// </summary> ! /// <param name="name">The name of the property.</param> ! /// <param name="value">The value of the property.</param> ! /// <returns> ! /// This <see cref="Configuration"/> object. ! /// </returns> public Configuration SetProperty( string name, string value ) { *************** *** 643,650 **** /// <summary> ! /// /// </summary> ! /// <param name="name"></param> ! /// <returns></returns> public string GetProperty( string name ) { --- 732,739 ---- /// <summary> ! /// Gets the value of the configuration property. /// </summary> ! /// <param name="name">The name of the property.</param> ! /// <returns>The configured value of the property, or <c>null</c> if the property was not specified.</returns> public string GetProperty( string name ) { *************** *** 689,694 **** public Configuration Configure( string resource ) { ! XmlTextReader reader = new XmlTextReader( resource ); ! return Configure( reader ); } --- 778,795 ---- public Configuration Configure( string resource ) { ! XmlTextReader reader = null; ! try ! { ! reader = new XmlTextReader( resource ); ! return Configure( reader ); ! } ! finally ! { ! if( reader!=null ) ! { ! reader.Close(); ! } ! } ! } *************** *** 709,720 **** } ! Stream stream = assembly.GetManifestResourceStream( resourceName ); ! if( stream == null ) { ! // resource does not exist - throw appropriate exception ! throw new HibernateException( "A ManifestResourceStream could not be created for the resource " + resourceName + " in Assembly " + assembly.FullName ); ! } ! return Configure( new XmlTextReader( stream ) ); } --- 810,832 ---- } ! Stream stream = null; ! try { ! stream = assembly.GetManifestResourceStream( resourceName ); ! if( stream==null ) ! { ! // resource does not exist - throw appropriate exception ! throw new HibernateException( "A ManifestResourceStream could not be created for the resource " + resourceName + " in Assembly " + assembly.FullName ); ! } ! return Configure( new XmlTextReader( stream ) ); ! } ! finally ! { ! if( stream!=null ) ! { ! stream.Close(); ! } ! } } *************** *** 757,760 **** --- 869,879 ---- throw new HibernateException( "problem parsing configuration : " + e ); } + finally + { + if( validatingReader!=null ) + { + validatingReader.Close(); + } + } XmlNode sfNode = doc.DocumentElement.SelectSingleNode( CfgNamespacePrefix + ":session-factory", CfgNamespaceMgr ); *************** *** 799,803 **** log.Debug( "properties: " + properties ); - validatingReader.Close(); return this; } --- 918,921 ---- |
From: Michael D. <mik...@us...> - 2005-02-21 14:27:45
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/CfgTest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21222/src/NHibernate.Test/CfgTest Modified Files: ConfigurationFixture.cs Log Message: NH-207: readers clean up after themselves. Index: ConfigurationFixture.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/CfgTest/ConfigurationFixture.cs,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** ConfigurationFixture.cs 28 Sep 2004 01:09:18 -0000 1.8 --- ConfigurationFixture.cs 21 Feb 2005 14:27:36 -0000 1.9 *************** *** 1,4 **** --- 1,6 ---- using System; using System.Collections; + using System.IO; + using System.Xml; using NHibernate.Cfg; *************** *** 74,78 **** --- 76,150 ---- } + /// <summary> + /// Verify that NHibernate properly releases resources when an Exception occurs + /// during the reading of config files. + /// </summary> + [Test] + public void InvalidXmlInCfgFile() + { + XmlDocument cfgXml = new XmlDocument(); + cfgXml.Load( "hibernate.cfg.xml" ); + + // this should put us at the first <property> element + XmlElement propElement = cfgXml.DocumentElement.GetElementsByTagName( "property" )[0] as XmlElement; + + // removing this will cause it not to validate + propElement.RemoveAttribute( "name" ); + + cfgXml.Save( "hibernate.invalid.cfg.xml" ); + + Configuration cfg = new Configuration(); + try + { + cfg.Configure( "hibernate.invalid.cfg.xml" ); + } + catch( HibernateException ) + { + // just absorb it - not what we are testing + } + finally + { + // clean up the bad file - if the Configure method cleans up after + // itself we should be able to do this without problem. If it does + // property release the resource then this won't be able to access + // the file to delete. + System.IO.File.Delete( "hibernate.invalid.cfg.xml" ); + } + + } + + [Test] + public void InvalidXmlInHbmFile() + { + string filename = "invalid.hbm.xml"; + // it's missing the class name - won't validate + string hbm = @"<?xml version='1.0' encoding='utf-8' ?> + <hibernate-mapping xmlns='urn:nhibernate-mapping-2.0'> + <class table='a'></class> + </hibernate-mapping>"; + XmlDocument hbmDoc = new XmlDocument(); + hbmDoc.LoadXml( hbm ); + hbmDoc.Save( filename ); + + Configuration cfg = new Configuration(); + try + { + cfg.Configure(); + cfg.AddXmlFile( "invalid.hbm.xml" ); + } + catch( HibernateException ) + { + // just absorb it - not what we are testing + } + finally + { + // clean up the bad file - if the AddXmlFile method cleans up after + // itself we should be able to do this without problem. If it does + // property release the resource then this won't be able to access + // the file to delete. + System.IO.File.Delete( filename ); + } + } } } |
From: Sergey K. <jus...@us...> - 2005-02-19 17:58:15
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.Test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13619/src/NHibernate.Test Modified Files: FooBarTest.cs Log Message: Changed NamedParams test to use and assume case-sensitive LIKE. My previous attempt to fix it using case-insensitive ILIKE broke SQL Server - thanks to Paul Hatcher for pointing that out. Index: FooBarTest.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/FooBarTest.cs,v retrieving revision 1.83 retrieving revision 1.84 diff -C2 -d -r1.83 -r1.84 *** FooBarTest.cs 16 Feb 2005 20:14:14 -0000 1.83 --- FooBarTest.cs 19 Feb 2005 17:58:04 -0000 1.84 *************** *** 592,596 **** "from Bar bar " + "inner join bar.Baz baz inner join baz.CascadingBars b " + ! "where bar.Name ilike 'bar%'" ); list = q.List(); Assert.AreEqual( 1, list.Count ); --- 592,596 ---- "from Bar bar " + "inner join bar.Baz baz inner join baz.CascadingBars b " + ! "where bar.Name like 'Bar%'" ); list = q.List(); Assert.AreEqual( 1, list.Count ); |
From: Michael D. <mik...@us...> - 2005-02-19 16:10:17
|
Update of /cvsroot/nhibernate/nhibernate In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18682 Modified Files: releasenotes.txt Log Message: updated release notes for everything in 0.7 Index: releasenotes.txt =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/releasenotes.txt,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** releasenotes.txt 23 Jan 2005 04:50:11 -0000 1.25 --- releasenotes.txt 19 Feb 2005 16:10:08 -0000 1.26 *************** *** 3,11 **** - Renamed class NHibernate.NHibernate to NHibernate.NHibernateUtil. This will break alot of code if you were using ISession.Find with parameters - migrate to IQuery instead. - Fixed bug with DateTime type where any value less than 1/1/1753 was written to the database as null. If you were relying on this then the Nullables library in NHibernateContrib is the way to code null values for DateTime properties. ! - Added IDisposable to EnumerableImpl. - Added default value of hibernate.connection.driver_class to Dialects. - Fixed messages in exceptions from GetGetter and GetSetter in BasicPropertyAccessor and NoSetterAccessor. - Improved messages in Exceptions thrown by ISetter. - Improved messages in Exceptions for Persisters with problems parsing discriminator values. Build 0.6.0.0 --- 3,29 ---- - Renamed class NHibernate.NHibernate to NHibernate.NHibernateUtil. This will break alot of code if you were using ISession.Find with parameters - migrate to IQuery instead. - Fixed bug with DateTime type where any value less than 1/1/1753 was written to the database as null. If you were relying on this then the Nullables library in NHibernateContrib is the way to code null values for DateTime properties. ! - Added ISession.Get() as an alternative to ISession.Load() (Sergey Koshcheyev). ! - Added IDisposable to EnumerableImpl, ISession, ITransaction, IBatcher, and IConnectionProvider. - Added default value of hibernate.connection.driver_class to Dialects. + - Added default value of hibernate.prepare_sql="false" to MsSql2000Dialect. + - Added [ComVisible(false)] to NHibernate AssemblyInfo. + - Added OracleDataClientDriver for Oracle.DataAccess assembly (James Mills). + - Added IDriver and Dialect for SQLite (Ioan Bizau). - Fixed messages in exceptions from GetGetter and GetSetter in BasicPropertyAccessor and NoSetterAccessor. + - Fixed problem of LazyInitializationException losing InnerException. + - Fixed problem of Collections not always getting cached. + - Fixed Id.TableGenerator so it works with Oracle. + - Fixed problem of some NHibernate Exceptions not being serializable. + - Improved documentation in IQuery to explain how SetMaxResult is working. - Improved messages in Exceptions thrown by ISetter. - Improved messages in Exceptions for Persisters with problems parsing discriminator values. + - Many internal cleanups from FxCop reccommendations. + - Modified ISession.Lock() to allow reassociating transient instances like hibernate 2.1 (Sergey Koshcheyev). + - Modified Exception thrown by Preparer when the IDbCommand.Prepare() method fails to ADOException. + - Modified SqlCommand.Parameter to be immutable. + - Modified how constraints are generated to work with MySql 4.1 (Bill Hawes). + - Modified Dialect to throw an ArgumentException when an unsupported DbType is used. + - Modified constructors on NHibernate Collections to be internal instead of public. + - Renamed Transaction to AdoTransaction. Build 0.6.0.0 |
From: Michael D. <mik...@us...> - 2005-02-19 15:14:01
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4911/src/NHibernate/Mapping Modified Files: Column.cs Log Message: Minor change to reduce type casting. Index: Column.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping/Column.cs,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** Column.cs 6 Jan 2005 14:19:59 -0000 1.16 --- Column.cs 19 Feb 2005 15:13:52 -0000 1.17 *************** *** 259,263 **** public override bool Equals( object obj ) { ! return obj is Column && Equals( ( Column ) obj ); } --- 259,264 ---- public override bool Equals( object obj ) { ! Column columnObj = obj as Column; ! return columnObj!=null && Equals( columnObj ); } |
From: John M. <joh...@nc...> - 2005-02-17 23:28:36
|
Those commit lines where mistakes. My code file template added them automatically. They should NOT be there. I thought I removed them all. -----Original Message----- From: nhi...@li... [mailto:nhi...@li...] On Behalf Of nhi...@li... Sent: Monday, February 14, 2005 11:11 PM To: nhi...@li... Subject: Nhibernate-commit digest, Vol 1 #406 - 4 msgs Send Nhibernate-commit mailing list submissions to nhi...@li... To subscribe or unsubscribe via the World Wide Web, visit https://lists.sourceforge.net/lists/listinfo/nhibernate-commit or, via email, send a message with subject or body 'help' to nhi...@li... You can reach the person managing the list at nhi...@li... When replying, please edit your Subject line so it is more specific than "Re: Contents of Nhibernate-commit digest..." Today's Topics: 1. Re: NHibernateContrib/src/NHibernate.Tool.Net2Hbm CollectionOneToManyAttribute.cs,NONE,1.1 (Kevin Williams) 2. Re: NHibernateContrib/src/NHibernate.Tool.Net2Hbm CollectionOneToManyAttribute.cs,NONE,1.1 (Mike Doerfler) 3. Re: Copyright vs LGPL (Sergey Koshcheyev) --__--__-- Message: 1 Date: Mon, 14 Feb 2005 08:05:48 -0700 From: Kevin Williams <ke...@ba...> To: nhi...@li... Subject: Re: [Nhibernate-commit] NHibernateContrib/src/NHibernate.Tool.Net2Hbm CollectionOneToManyAttribute.cs,NONE,1.1 Reply-To: nhi...@li... I can't help but wonder if the copyright line below is OK with GPL? Does = anyone know? > --- NEW FILE: CollectionOneToManyAttribute.cs --- > #region Copyright (c) 2004 Schwab Performance Technologies, Inc. All=20 > rights reserved. ---------- Scanned for viruses by ClamAV --__--__-- Message: 2 Date: Mon, 14 Feb 2005 11:15:04 -0600 From: Mike Doerfler <mik...@gm...> To: nhi...@li... Subject: Re: [Nhibernate-commit] NHibernateContrib/src/NHibernate.Tool.Net2Hbm CollectionOneToManyAttribute.cs,NONE,1.1 Reply-To: nhi...@li... I believe (not for sure) that it is fine with the LGPL from a legal standpoint - IANAL. The LGPL that the product is distributed under is = more significant than a copyright. What the copyright does provide is that I could not go change NHibernateContrib to the Apache License or GPL = without the copyright holders permission (Not that I would ever do that). The Mozilla website has some FAQs about the process they went through when = the had to relicense it and getting permissions from copyright holders. In NHibernate core the Iesi.Collections and IdentityHashCodeProvider has copyrights associated with them. The only requirement is to list that copyright wherever other copyrights are listed. If anyone else has more experience or knowledge of Open Source licenses please speak up. Mike On Mon, 14 Feb 2005 08:05:48 -0700, Kevin Williams = <ke...@ba...> wrote: > I can't help but wonder if the copyright line below is OK with GPL?=20 > Does anyone know? >=20 > > --- NEW FILE: CollectionOneToManyAttribute.cs --- > > #region Copyright (c) 2004 Schwab Performance Technologies, Inc. All = > > rights reserved. >=20 > ---------- > Scanned for viruses by ClamAV >=20 >=20 > ------------------------------------------------------- > SF email is sponsored by - The IT Product Guide > Read honest & candid reviews on hundreds of IT Products from real=20 > users. Discover which products truly live up to the hype. Start=20 > reading now. = http://ads.osdn.com/?ad_id=3D6595&alloc_id=3D14396&op=3Dclick > _______________________________________________ > Nhibernate-commit mailing list Nhi...@li... > https://lists.sourceforge.net/lists/listinfo/nhibernate-commit > --__--__-- Message: 3 Date: Mon, 14 Feb 2005 18:27:54 +0100 From: Sergey Koshcheyev <ser...@gm...> To: nhi...@li... Subject: Re: [Nhibernate-commit] Copyright vs LGPL Reply-To: nhi...@li... Mike Doerfler wrote: >I believe (not for sure) that it is fine with the LGPL from a legal=20 >standpoint - IANAL. The LGPL that the product is distributed under is=20 >more significant than a copyright. What the copyright does provide is=20 >that I could not go change NHibernateContrib to the Apache License or=20 >GPL without the copyright holders permission (Not that I would ever do=20 >that). The Mozilla website has some FAQs about the process they went=20 >through when the had to relicense it and getting permissions from=20 >copyright holders. > >In NHibernate core the Iesi.Collections and IdentityHashCodeProvider=20 >has copyrights associated with them. The only requirement is to list=20 >that copyright wherever other copyrights are listed. > >If anyone else has more experience or knowledge of Open Source licenses = >please speak up. > >Mike > =20 > Well, I'm not a lawyer, of course, and I tend to agree with Mike's point = of view. I just wonder exactly which rights "All rights reserved" refers = to. Sergey. --__--__-- _______________________________________________ Nhibernate-commit mailing list Nhi...@li... https://lists.sourceforge.net/lists/listinfo/nhibernate-commit End of Nhibernate-commit Digest |
From: Kevin W. <kev...@us...> - 2005-02-17 15:08:45
|
Update of /cvsroot/nhibernate/NHibernateContrib/src/NHibernate.Caches.Prevalence In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1382 Modified Files: PrevalenceCache.cs PrevalenceCacheFixture.cs Log Message: implement region handling thanks to James McKay for the code suggestion Index: PrevalenceCacheFixture.cs =================================================================== RCS file: /cvsroot/nhibernate/NHibernateContrib/src/NHibernate.Caches.Prevalence/PrevalenceCacheFixture.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** PrevalenceCacheFixture.cs 13 Jan 2005 23:10:33 -0000 1.1 --- PrevalenceCacheFixture.cs 17 Feb 2005 15:08:36 -0000 1.2 *************** *** 138,141 **** --- 138,156 ---- cache.Remove( null ); } + + [Test] + public void TestRegions() + { + string key = "key"; + ICache cache1 = provider.BuildCache( "nunit1", props ); + ICache cache2 = provider.BuildCache( "nunit2", props ); + string s1 = "test1"; + string s2 = "test2"; + cache1.Put( key, s1 ); + cache2.Put( key, s2 ); + object get1 = cache1.Get( key ); + object get2 = cache2.Get( key ); + Assert.IsFalse( get1 == get2 ); + } } } \ No newline at end of file Index: PrevalenceCache.cs =================================================================== RCS file: /cvsroot/nhibernate/NHibernateContrib/src/NHibernate.Caches.Prevalence/PrevalenceCache.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** PrevalenceCache.cs 13 Jan 2005 23:10:32 -0000 1.1 --- PrevalenceCache.cs 17 Feb 2005 15:08:36 -0000 1.2 *************** *** 14,17 **** --- 14,18 ---- { private static readonly ILog log = LogManager.GetLogger( typeof( PrevalenceCache ) ); + private static readonly string _cacheKeyPrefix = "NHibernate-Cache:"; private string _region; private PrevalenceEngine _engine; *************** *** 21,25 **** /// default constructor /// </summary> ! public PrevalenceCache() : this( null, null ) { } --- 22,26 ---- /// default constructor /// </summary> ! public PrevalenceCache() : this( "nhibernate", null ) { } *************** *** 50,54 **** private void Configure( IDictionary properties ) { ! string dataDir = Path.Combine( Environment.CurrentDirectory, "data" ); if( properties != null ) --- 51,55 ---- private void Configure( IDictionary properties ) { ! string dataDir = Path.Combine( Environment.CurrentDirectory, _region ); if( properties != null ) *************** *** 83,86 **** --- 84,92 ---- } + private string GetCacheKey( object key ) + { + return String.Concat( _cacheKeyPrefix, _region, ":", key.ToString() ); + } + /// <summary></summary> /// <param name="key"></param> *************** *** 92,100 **** return null; } if( log.IsDebugEnabled ) { ! log.Debug( "getting object with key: " + key.ToString() ); } ! return _system.Get( key ); } --- 98,107 ---- return null; } + string cacheKey = GetCacheKey( key ); if( log.IsDebugEnabled ) { ! log.Debug( String.Format( "Fetching object '{0}' from the cache.", cacheKey ) ); } ! return _system.Get( cacheKey ); } *************** *** 120,128 **** throw new ArgumentNullException( "value", "null value not allowed" ); } if( log.IsDebugEnabled ) { ! log.Debug( String.Format( "setting value {1} for key {0}", key.ToString(), value.ToString() ) ); } ! _system.Add( key, value ); } --- 127,136 ---- throw new ArgumentNullException( "value", "null value not allowed" ); } + string cacheKey = GetCacheKey( key ); if( log.IsDebugEnabled ) { ! log.Debug( String.Format( "setting value {1} for key {0}", cacheKey, value.ToString() ) ); } ! _system.Add( cacheKey, value ); } *************** *** 139,147 **** throw new ArgumentNullException( "key" ); } if( log.IsDebugEnabled ) { ! log.Debug( "removing item with key: " + key.ToString() ); } ! _system.Remove( key ); } --- 147,156 ---- throw new ArgumentNullException( "key" ); } + string cacheKey = GetCacheKey( key ); if( log.IsDebugEnabled ) { ! log.Debug( "removing item with key: " + cacheKey ); } ! _system.Remove( cacheKey ); } *************** *** 171,174 **** --- 180,184 ---- set { _region = value; } } + #region IDisposable Members |
From: Kevin W. <kev...@us...> - 2005-02-17 15:04:33
|
Update of /cvsroot/nhibernate/NHibernateContrib/src/BantamTech.SysCache In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv304 Modified Files: AssemblyInfo.cs SysCache.cs SysCacheFixture.cs Log Message: fixing region handling http://jira.nhibernate.org/browse/NH-194 thanks to James McKay Index: SysCacheFixture.cs =================================================================== RCS file: /cvsroot/nhibernate/NHibernateContrib/src/BantamTech.SysCache/SysCacheFixture.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** SysCacheFixture.cs 13 Jan 2005 23:07:23 -0000 1.3 --- SysCacheFixture.cs 17 Feb 2005 15:04:24 -0000 1.4 *************** *** 212,215 **** --- 212,230 ---- cache.Remove( null ); } + + [Test] + public void TestRegions() + { + string key = "key"; + ICache cache1 = provider.BuildCache( "nunit1", props ); + ICache cache2 = provider.BuildCache( "nunit2", props ); + string s1 = "test1"; + string s2 = "test2"; + cache1.Put( key, s1 ); + cache2.Put( key, s2 ); + object get1 = cache1.Get( key ); + object get2 = cache2.Get( key ); + Assert.IsFalse( get1 == get2 ); + } } } \ No newline at end of file Index: SysCache.cs =================================================================== RCS file: /cvsroot/nhibernate/NHibernateContrib/src/BantamTech.SysCache/SysCache.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** SysCache.cs 7 Dec 2004 19:59:16 -0000 1.1 --- SysCache.cs 17 Feb 2005 15:04:24 -0000 1.2 *************** *** 45,48 **** --- 45,49 ---- private Hashtable _map; private static readonly TimeSpan _defaultRelativeExpiration = TimeSpan.FromSeconds( 300 ); + private static readonly string _cacheKeyPrefix = "NHibernate-Cache:"; /// <summary> *************** *** 205,208 **** --- 206,214 ---- } + private string GetCacheKey( object key ) + { + return String.Concat( _cacheKeyPrefix, _region, ":", key.ToString() ); + } + /// <summary></summary> /// <param name="key"></param> *************** *** 214,218 **** return null; } ! return _cache.Get( key.ToString() ); } --- 220,229 ---- return null; } ! string cacheKey = GetCacheKey( key ); ! if( log.IsDebugEnabled ) ! { ! log.Debug( String.Format( "Fetching object '{0}' from the cache.", cacheKey ) ); ! } ! return _cache.Get( cacheKey ); } *************** *** 230,240 **** throw new ArgumentNullException( "value", "null value not allowed" ); } ! if( _cache[key.ToString()] != null ) { if( log.IsDebugEnabled ) { ! log.Debug( "updating value of key '" + key.ToString() + "' to: " + value.ToString() ); } ! _cache[key.ToString()] = value; } else --- 241,252 ---- throw new ArgumentNullException( "value", "null value not allowed" ); } ! string cacheKey = GetCacheKey( key ); ! if( _cache[ cacheKey ] != null ) { if( log.IsDebugEnabled ) { ! log.Debug( String.Format("updating value of key '{0}' to '{1}'.", cacheKey, value.ToString() ) ); } ! _cache[ cacheKey ] = value; } else *************** *** 242,252 **** if( log.IsDebugEnabled ) { ! log.Debug( "adding new data: key=" + key.ToString() + "&value=" + value.ToString() ); } ! _map.Add( key.ToString(), value ); ! _cache.Add( key.ToString(), value, null, _absExpiration, _slidingExpiration, _priority, null ); } } /// <summary></summary> /// <param name="key"></param> --- 254,279 ---- if( log.IsDebugEnabled ) { ! log.Debug( String.Format("adding new data: key={0}&value={1}", cacheKey, value.ToString() ) ); } ! _map.Add( cacheKey, value ); ! _cache.Add( ! cacheKey, value, null, ! _absExpiration, _slidingExpiration, _priority, ! new CacheItemRemovedCallback( this.CacheItemRemoved ) ! ); } } + /// <summary> + /// make sure the Hashtable is in sync with the cache by using the callback. + /// </summary> + /// <param name="key"></param> + /// <param name="value"></param> + /// <param name="reason"></param> + public void CacheItemRemoved( string key, object value, CacheItemRemovedReason reason ) + { + _map.Remove( key ); + } + /// <summary></summary> /// <param name="key"></param> *************** *** 257,262 **** throw new ArgumentNullException( "key" ); } ! _map.Remove( key.ToString() ); ! _cache.Remove( key.ToString() ); } --- 284,294 ---- throw new ArgumentNullException( "key" ); } ! string cacheKey = GetCacheKey( key ); ! if( log.IsDebugEnabled ) ! { ! log.Debug( "removing item with key: " + cacheKey ); ! } ! _map.Remove( cacheKey ); // possibly not needed now that callbacks are used ! _cache.Remove( cacheKey ); } *************** *** 264,270 **** public void Clear() { ! foreach( DictionaryEntry entry in _map ) { ! _cache.Remove( entry.Key.ToString() ); } _map.Clear(); --- 296,303 ---- public void Clear() { ! ArrayList keys = new ArrayList( _map.Keys ); ! foreach( object key in keys ) { ! _cache.Remove( key.ToString() ); } _map.Clear(); Index: AssemblyInfo.cs =================================================================== RCS file: /cvsroot/nhibernate/NHibernateContrib/src/BantamTech.SysCache/AssemblyInfo.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** AssemblyInfo.cs 6 Jan 2005 00:23:35 -0000 1.4 --- AssemblyInfo.cs 17 Feb 2005 15:04:24 -0000 1.5 *************** *** 8,12 **** // <autogenerated> // This code was generated by a tool. ! // Runtime Version: 1.1.4322.573 // // Changes to this file may cause incorrect behavior and will be lost if --- 8,12 ---- // <autogenerated> // This code was generated by a tool. ! // Runtime Version: 1.1.4322.2032 // // Changes to this file may cause incorrect behavior and will be lost if *************** *** 22,25 **** [assembly: AssemblyVersionAttribute("0.6.0.0")] [assembly: AssemblyInformationalVersionAttribute("0.6")] - //[assembly: AssemblyKeyFileAttribute("..\\NHibernate.snk")] --- 22,24 ---- |
From: Michael D. <mik...@us...> - 2005-02-17 14:03:14
|
Update of /cvsroot/nhibernate/NHibernateContrib/src/Nullables.Tests/NHibernate In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18737/Nullables.Tests/NHibernate Modified Files: NullablesClass.cs NullablesClass.hbm.xml NullablesFixture.cs Log Message: Add NullableSByte int Nullables.NHibernate and added to test fixture. Index: NullablesFixture.cs =================================================================== RCS file: /cvsroot/nhibernate/NHibernateContrib/src/Nullables.Tests/NHibernate/NullablesFixture.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** NullablesFixture.cs 12 Nov 2004 22:08:27 -0000 1.1 --- NullablesFixture.cs 17 Feb 2005 14:03:06 -0000 1.2 *************** *** 54,57 **** --- 54,58 ---- Assert.AreEqual( NullableInt32.Default, nullNC.Int32Prop ); Assert.AreEqual( NullableInt64.Default, nullNC.Int64Prop ); + Assert.AreEqual( NullableSByte.Default, nullNC.SByteProp ); Assert.AreEqual( NullableSingle.Default, nullNC.SingleProp ); *************** *** 111,114 **** --- 112,116 ---- nc.Int32Prop = NullableInt32.Default; nc.Int64Prop = NullableInt64.Default; + nc.SByteProp = NullableSByte.Default; nc.SingleProp = NullableSingle.Default; *************** *** 130,133 **** --- 132,136 ---- nc.Int32Prop = Int32.MaxValue; nc.Int64Prop = Int64.MaxValue; + nc.SByteProp = SByte.MaxValue; nc.SingleProp = 4.3f; Index: NullablesClass.hbm.xml =================================================================== RCS file: /cvsroot/nhibernate/NHibernateContrib/src/Nullables.Tests/NHibernate/NullablesClass.hbm.xml,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** NullablesClass.hbm.xml 12 Nov 2004 22:08:27 -0000 1.1 --- NullablesClass.hbm.xml 17 Feb 2005 14:03:06 -0000 1.2 *************** *** 35,38 **** --- 35,41 ---- type="Nullables.NHibernate.NullableInt64Type, Nullables.NHibernate" /> + <property name="SByteProp" column="null_sby" + type="Nullables.NHibernate.NullableSByteType, Nullables.NHibernate" + /> <property name="SingleProp" column="null_sing" type="Nullables.NHibernate.NullableSingleType, Nullables.NHibernate" Index: NullablesClass.cs =================================================================== RCS file: /cvsroot/nhibernate/NHibernateContrib/src/Nullables.Tests/NHibernate/NullablesClass.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** NullablesClass.cs 12 Nov 2004 22:08:27 -0000 1.1 --- NullablesClass.cs 17 Feb 2005 14:03:06 -0000 1.2 *************** *** 20,23 **** --- 20,24 ---- private NullableInt32 _int32Prop; private NullableInt64 _int64Prop; + private NullableSByte _sbyteProp; private NullableSingle _singleProp; *************** *** 93,96 **** --- 94,103 ---- } + public NullableSByte SByteProp + { + get { return _sbyteProp; } + set { _sbyteProp = value; } + } + public NullableSingle SingleProp { |
From: Michael D. <mik...@us...> - 2005-02-17 14:03:14
|
Update of /cvsroot/nhibernate/NHibernateContrib/src/Nullables.NHibernate In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18737/Nullables.NHibernate Modified Files: Nullables.NHibernate-1.1.csproj NullableSByteType.cs Log Message: Add NullableSByte int Nullables.NHibernate and added to test fixture. Index: NullableSByteType.cs =================================================================== RCS file: /cvsroot/nhibernate/NHibernateContrib/src/Nullables.NHibernate/NullableSByteType.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** NullableSByteType.cs 10 Dec 2004 18:24:19 -0000 1.1 --- NullableSByteType.cs 17 Feb 2005 14:03:05 -0000 1.2 *************** *** 64,68 **** else { ! return new NullableSByte((SByte)value); } } --- 64,68 ---- else { ! return new NullableSByte( Convert.ToSByte( value ) ); } } *************** *** 79,83 **** else { ! return new NullableSByte((SByte)value); } } --- 79,84 ---- else { ! ! return new NullableSByte( Convert.ToSByte( value ) ); } } Index: Nullables.NHibernate-1.1.csproj =================================================================== RCS file: /cvsroot/nhibernate/NHibernateContrib/src/Nullables.NHibernate/Nullables.NHibernate-1.1.csproj,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Nullables.NHibernate-1.1.csproj 12 Nov 2004 22:08:26 -0000 1.1 --- Nullables.NHibernate-1.1.csproj 17 Feb 2005 14:03:05 -0000 1.2 *************** *** 154,157 **** --- 154,162 ---- /> <File + RelPath = "NullableSByteType.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "NullableSingleType.cs" SubType = "Code" |
From: Sergey K. <jus...@us...> - 2005-02-16 20:15:21
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Loader In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30719/src/NHibernate/Loader Modified Files: Loader.cs Log Message: Renamed PersistentCollection.ForceLoad to ForceInitialization, in accordance with H2.1 Added non-lazy collections handling which fixed a bug when non-lazy collections didn't initialize. Index: Loader.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Loader/Loader.cs,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** Loader.cs 6 Feb 2005 01:59:02 -0000 1.46 --- Loader.cs 16 Feb 2005 20:14:38 -0000 1.47 *************** *** 123,126 **** --- 123,156 ---- } + // This method is called DoQueryAndInitializeNonLazyCollections in H2.1, + // since DoFind is called DoQuery and is split into several smaller methods. + private IList DoFindAndInitializeNonLazyCollections( + ISessionImplementor session, + QueryParameters parameters, + object optionalObject, + object optionalID, + PersistentCollection optionalCollection, + object optionalCollectionOwner, + bool returnProxies ) + { + session.BeforeLoad(); + + IList result; + + try + { + result = DoFind( + session, parameters, optionalObject, optionalID, + optionalCollection, optionalCollectionOwner, returnProxies); + } + finally + { + session.AfterLoad(); + } + + session.InitializeNonLazyCollections(); + return result; + } + /// <summary> /// Execute an SQL query and attempt to instantiate instances of the class mapped by the given *************** *** 798,802 **** { QueryParameters qp = new QueryParameters( types, values ); ! return DoFind( session, qp, optionalObject, optionalID, null, null, returnProxies ); } --- 828,832 ---- { QueryParameters qp = new QueryParameters( types, values ); ! return DoFindAndInitializeNonLazyCollections( session, qp, optionalObject, optionalID, null, null, returnProxies ); } *************** *** 818,822 **** { QueryParameters qp = new QueryParameters( new IType[ ] {type}, new object[ ] {id} ); ! return DoFind( session, qp, null, null, collection, owner, true ); } --- 848,852 ---- { QueryParameters qp = new QueryParameters( new IType[ ] {type}, new object[ ] {id} ); ! return DoFindAndInitializeNonLazyCollections( session, qp, null, null, collection, owner, true ); } *************** *** 833,837 **** bool returnProxies ) { ! return DoFind( session, parameters, null, null, null, null, returnProxies ); } --- 863,867 ---- bool returnProxies ) { ! return DoFindAndInitializeNonLazyCollections( session, parameters, null, null, null, null, returnProxies ); } |
From: Sergey K. <jus...@us...> - 2005-02-16 20:15:17
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Impl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30719/src/NHibernate/Impl Modified Files: SessionImpl.cs Log Message: Renamed PersistentCollection.ForceLoad to ForceInitialization, in accordance with H2.1 Added non-lazy collections handling which fixed a bug when non-lazy collections didn't initialize. Index: SessionImpl.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Impl/SessionImpl.cs,v retrieving revision 1.66 retrieving revision 1.67 diff -C2 -d -r1.66 -r1.67 *** SessionImpl.cs 11 Feb 2005 21:26:23 -0000 1.66 --- SessionImpl.cs 16 Feb 2005 20:14:20 -0000 1.67 *************** *** 186,189 **** --- 186,192 ---- [NonSerialized] + private int loadCounter = 0; + + [NonSerialized] private bool flushing; *************** *** 191,194 **** --- 194,200 ---- private IBatcher batcher; + [NonSerialized] + private IList nonlazyCollections = new ArrayList(20); + #region System.Runtime.Serialization.ISerializable Members *************** *** 2533,2537 **** AddEntry( result, Status.Loaded, values, id, version, LockMode.None, true, subclassPersister ); ! // TODO: InitializeNonLazyCollections(); // upgrate lock if necessary; --- 2539,2543 ---- AddEntry( result, Status.Loaded, values, id, version, LockMode.None, true, subclassPersister ); ! InitializeNonLazyCollections(); // upgrate lock if necessary; *************** *** 3489,3493 **** { log.Debug( "forcing collection initialization" ); ! coll.ForceLoad(); } } --- 3495,3499 ---- { log.Debug( "forcing collection initialization" ); ! coll.ForceInitialization(); } } *************** *** 3513,3516 **** --- 3519,3523 ---- private IDictionary loadingCollections = new Hashtable(); + private string loadingRole; *************** *** 3651,3654 **** --- 3658,3697 ---- } + public void BeforeLoad() + { + loadCounter++; + } + + public void AfterLoad() + { + loadCounter--; + } + + public void InitializeNonLazyCollections() + { + if( loadCounter==0 ) + { + log.Debug( "initializing non-lazy collections" ); + // Do this work only at the very highest level of the load + + // Don't let this method be called recursively + loadCounter++; + try + { + while (nonlazyCollections.Count > 0) + { + //note that each iteration of the loop may add new elements + PersistentCollection collection = (PersistentCollection)nonlazyCollections[ nonlazyCollections.Count - 1 ]; + nonlazyCollections.RemoveAt( nonlazyCollections.Count - 1 ); + collection.ForceInitialization(); + } + } + finally + { + loadCounter--; + } + } + } + private PersistentCollection GetCollection(CollectionKey key) { *************** *** 4545,4549 **** else if ( !persister.IsLazy ) { ! //nonlazyCollections.Add(collection); } return collection.GetValue(); --- 4588,4592 ---- else if ( !persister.IsLazy ) { ! nonlazyCollections.Add(collection); } return collection.GetValue(); |
From: Sergey K. <jus...@us...> - 2005-02-16 20:15:09
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Engine In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30719/src/NHibernate/Engine Modified Files: ISessionImplementor.cs Log Message: Renamed PersistentCollection.ForceLoad to ForceInitialization, in accordance with H2.1 Added non-lazy collections handling which fixed a bug when non-lazy collections didn't initialize. Index: ISessionImplementor.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Engine/ISessionImplementor.cs,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** ISessionImplementor.cs 7 Feb 2005 01:34:40 -0000 1.28 --- ISessionImplementor.cs 16 Feb 2005 20:14:19 -0000 1.29 *************** *** 79,82 **** --- 79,97 ---- /// <summary> + /// new in h2.1 and no javadoc + /// </summary> + void AfterLoad(); + + /// <summary> + /// new in h2.1 and no javadoc + /// </summary> + void BeforeLoad(); + + /// <summary> + /// new in h2.1 and no javadoc + /// </summary> + void InitializeNonLazyCollections(); + + /// <summary> /// Gets the NHibernate collection wrapper from the ISession. /// </summary> |
From: Sergey K. <jus...@us...> - 2005-02-16 20:14:59
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Collection In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30719/src/NHibernate/Collection Modified Files: PersistentCollection.cs Log Message: Renamed PersistentCollection.ForceLoad to ForceInitialization, in accordance with H2.1 Added non-lazy collections handling which fixed a bug when non-lazy collections didn't initialize. Index: PersistentCollection.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Collection/PersistentCollection.cs,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** PersistentCollection.cs 7 Feb 2005 01:34:40 -0000 1.20 --- PersistentCollection.cs 16 Feb 2005 20:14:16 -0000 1.21 *************** *** 485,494 **** /// <summary> ! /// Default behavior is to call Read; will be overridden in deep lazy collections /// </summary> ! /// TODO: H2.0.3 declares this as final ! public void ForceLoad() { ! Read(); } --- 485,500 ---- /// <summary> ! /// To be called internally by the session, forcing ! /// immediate initalization. /// </summary> ! /// <remarks> ! /// This method is similar to <see cref="Initialize" />, except that different exceptions are thrown. ! /// </remarks> ! public void ForceInitialization() { ! if( initializing ) throw new AssertionFailure("force initialize loading collection"); ! if( session == null ) throw new HibernateException("collection is not associated with any session"); ! if( !session.IsConnected ) throw new HibernateException("disconnected session"); ! if( !initialized ) session.InitializeCollection(this, false); } |
From: Sergey K. <jus...@us...> - 2005-02-16 20:14:56
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.Test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30719/src/NHibernate.Test Modified Files: FooBarTest.cs Log Message: Renamed PersistentCollection.ForceLoad to ForceInitialization, in accordance with H2.1 Added non-lazy collections handling which fixed a bug when non-lazy collections didn't initialize. Index: FooBarTest.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/FooBarTest.cs,v retrieving revision 1.82 retrieving revision 1.83 diff -C2 -d -r1.82 -r1.83 *** FooBarTest.cs 24 Jan 2005 03:44:48 -0000 1.82 --- FooBarTest.cs 16 Feb 2005 20:14:14 -0000 1.83 *************** *** 592,596 **** "from Bar bar " + "inner join bar.Baz baz inner join baz.CascadingBars b " + ! "where bar.Name like 'bar%'" ); list = q.List(); Assert.AreEqual( 1, list.Count ); --- 592,596 ---- "from Bar bar " + "inner join bar.Baz baz inner join baz.CascadingBars b " + ! "where bar.Name ilike 'bar%'" ); list = q.List(); Assert.AreEqual( 1, list.Count ); *************** *** 2785,2792 **** t.Commit(); } ! catch (Exception e) { t.Rollback(); ! throw e; } finally --- 2785,2792 ---- t.Commit(); } ! catch (Exception) { t.Rollback(); ! throw; } finally *************** *** 2823,2830 **** t.Commit(); } ! catch(Exception e) { t.Rollback(); ! throw e; } finally --- 2823,2830 ---- t.Commit(); } ! catch(Exception) { t.Rollback(); ! throw; } finally *************** *** 3644,3648 **** enumer.MoveNext(); Assert.IsFalse( enumer.Current is Proxy.INHibernateProxy ); // many-to-many outer-join="true" ! } enumer = baz.FooSet.GetEnumerator(); --- 3644,3648 ---- enumer.MoveNext(); Assert.IsFalse( enumer.Current is Proxy.INHibernateProxy ); // many-to-many outer-join="true" ! } enumer = baz.FooSet.GetEnumerator(); *************** *** 3685,3688 **** --- 3685,3717 ---- } + [Test] + public void NonLazyCollections() + { + object glarchId; + + using( ISession s = sessions.OpenSession() ) + { + Glarch glarch1 = new Glarch(); + glarch1.ProxySet = new Iesi.Collections.ListSet(); + + Glarch glarch2 = new Glarch(); + glarch1.ProxySet.Add( glarch1 ); + + s.Save( glarch2 ); + glarchId = s.Save( glarch1 ); + s.Flush(); + } + + Glarch loadedGlarch; + using( ISession s = sessions.OpenSession() ) + { + loadedGlarch = (Glarch)s.Get( typeof( Glarch ), glarchId ); + Assert.IsTrue( NHibernateUtil.IsInitialized( loadedGlarch.ProxySet ) ); + } + + // ProxySet is a non-lazy collection, so this should work outside + // a session. + Assert.AreEqual( 1, loadedGlarch.ProxySet.Count ); + } } } |
From: Sergey K. <jus...@us...> - 2005-02-16 20:14:52
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30719/src/NHibernate Modified Files: NHibernateUtil.cs Log Message: Renamed PersistentCollection.ForceLoad to ForceInitialization, in accordance with H2.1 Added non-lazy collections handling which fixed a bug when non-lazy collections didn't initialize. Index: NHibernateUtil.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/NHibernateUtil.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** NHibernateUtil.cs 17 Jan 2005 03:40:49 -0000 1.1 --- NHibernateUtil.cs 16 Feb 2005 20:14:40 -0000 1.2 *************** *** 261,265 **** else if( proxy is PersistentCollection ) { ! ( ( PersistentCollection ) proxy ).ForceLoad(); } } --- 261,265 ---- else if( proxy is PersistentCollection ) { ! ( ( PersistentCollection ) proxy ).ForceInitialization(); } } |
From: Sergey K. <jus...@us...> - 2005-02-16 20:09:29
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/ExpressionTest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29335/src/NHibernate.Test/ExpressionTest Modified Files: InsensitiveLikeExpressionFixture.cs Log Message: Make the test pass for PostgreSQL, using a bit of a hack Index: InsensitiveLikeExpressionFixture.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/ExpressionTest/InsensitiveLikeExpressionFixture.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** InsensitiveLikeExpressionFixture.cs 30 Jan 2005 19:39:52 -0000 1.3 --- InsensitiveLikeExpressionFixture.cs 16 Feb 2005 20:09:18 -0000 1.4 *************** *** 30,33 **** --- 30,37 ---- string expectedSql = "lower(simple_alias.address) like :simple_alias.address"; + if ((factory as ISessionFactoryImplementor).Dialect is Dialect.PostgreSQLDialect) + { + expectedSql = "simple_alias.address ilike :simple_alias.address"; + } Parameter[] expectedParams = new Parameter[1]; |
From: Sergey K. <ser...@gm...> - 2005-02-14 17:27:58
|
Mike Doerfler wrote: >I believe (not for sure) that it is fine with the LGPL from a legal >standpoint - IANAL. The LGPL that the product is distributed under is >more significant than a copyright. What the copyright does provide is >that I could not go change NHibernateContrib to the Apache License or >GPL without the copyright holders permission (Not that I would ever do >that). The Mozilla website has some FAQs about the process they went >through when the had to relicense it and getting permissions from >copyright holders. > >In NHibernate core the Iesi.Collections and IdentityHashCodeProvider >has copyrights associated with them. The only requirement is to list >that copyright wherever other copyrights are listed. > >If anyone else has more experience or knowledge of Open Source >licenses please speak up. > >Mike > > Well, I'm not a lawyer, of course, and I tend to agree with Mike's point of view. I just wonder exactly which rights "All rights reserved" refers to. Sergey. |
From: Mike D. <mik...@gm...> - 2005-02-14 17:15:10
|
I believe (not for sure) that it is fine with the LGPL from a legal standpoint - IANAL. The LGPL that the product is distributed under is more significant than a copyright. What the copyright does provide is that I could not go change NHibernateContrib to the Apache License or GPL without the copyright holders permission (Not that I would ever do that). The Mozilla website has some FAQs about the process they went through when the had to relicense it and getting permissions from copyright holders. In NHibernate core the Iesi.Collections and IdentityHashCodeProvider has copyrights associated with them. The only requirement is to list that copyright wherever other copyrights are listed. If anyone else has more experience or knowledge of Open Source licenses please speak up. Mike On Mon, 14 Feb 2005 08:05:48 -0700, Kevin Williams <ke...@ba...> wrote: > I can't help but wonder if the copyright line below is OK with GPL? Does > anyone know? > > > --- NEW FILE: CollectionOneToManyAttribute.cs --- > > #region Copyright (c) 2004 Schwab Performance Technologies, Inc. All rights reserved. > > ---------- > Scanned for viruses by ClamAV > > > ------------------------------------------------------- > SF email is sponsored by - The IT Product Guide > Read honest & candid reviews on hundreds of IT Products from real users. > Discover which products truly live up to the hype. Start reading now. > http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click > _______________________________________________ > Nhibernate-commit mailing list > Nhi...@li... > https://lists.sourceforge.net/lists/listinfo/nhibernate-commit > |
From: Kevin W. <ke...@ba...> - 2005-02-14 15:06:03
|
I can't help but wonder if the copyright line below is OK with GPL? Does anyone know? > --- NEW FILE: CollectionOneToManyAttribute.cs --- > #region Copyright (c) 2004 Schwab Performance Technologies, Inc. All rights reserved. ---------- Scanned for viruses by ClamAV |