Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Cfg
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30426/Cfg
Modified Files:
Binder.cs Mappings.cs
Log Message:
Modified the imports to map a class name and fullyqualifiedname to
assemblyqualifiedname.
Index: Mappings.cs
===================================================================
RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Cfg/Mappings.cs,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** Mappings.cs 30 Apr 2004 08:20:50 -0000 1.6
--- Mappings.cs 16 Aug 2004 05:07:45 -0000 1.7
***************
*** 56,63 ****
}
public void AddImport(string className, string rename)
{
! if ( imports.Contains(rename) && (string)imports[rename] != className)
throw new MappingException("duplicate import: " + rename);
imports.Add(rename, className);
}
--- 56,71 ----
}
+ /// <summary>
+ /// Adds an import to allow for the full class name <c>Namespace.BusClass</c>
+ /// to be referenced as <c>BusClass</c> or some other name in Hql.
+ /// </summary>
+ /// <param name="className">The name of the class that is being renamed.</param>
+ /// <param name="rename">The new name to use in Hql for the class.</param>
public void AddImport(string className, string rename)
{
! if ( imports.Contains(rename) && (string)imports[rename] != className)
! {
throw new MappingException("duplicate import: " + rename);
+ }
imports.Add(rename, className);
}
Index: Binder.cs
===================================================================
RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Cfg/Binder.cs,v
retrieving revision 1.26
retrieving revision 1.27
diff -C2 -d -r1.26 -r1.27
*** Binder.cs 13 Aug 2004 18:53:39 -0000 1.26
--- Binder.cs 16 Aug 2004 05:07:45 -0000 1.27
***************
*** 1,5 ****
using System;
- using System.Xml;
using System.Collections;
using NHibernate.Engine;
using NHibernate.Loader;
--- 1,7 ----
using System;
using System.Collections;
+ using System.Text;
+ using System.Xml;
+
using NHibernate.Engine;
using NHibernate.Loader;
***************
*** 8,12 ****
using NHibernate.Type;
using NHibernate.Util;
- using System.Text;
namespace NHibernate.Cfg {
--- 10,13 ----
***************
*** 67,73 ****
//import
if (mapping.IsAutoImport)
{
! mapping.AddImport( StringHelper.GetFullClassname(className), StringHelper.GetClassname(className) );
}
}
--- 68,83 ----
//import
+
+ // we automattically want to add an import of the Assembly Qualified Name (includes version,
+ // culture, public-key) to the className supplied in the hbm.xml file. The most common use-case
+ // will have it contain the "FullClassname, AssemblyName", it might contain version, culture,
+ // public key, etc...) but should not assume it does.
+ mapping.AddImport( model.PersistentClazz.AssemblyQualifiedName, StringHelper.GetFullClassname(className) );
+
+ // if we are supposed to auto-import the Class then add an import to get from the Classname
+ // to the Assembly Qualified Class Name
if (mapping.IsAutoImport)
{
! mapping.AddImport( model.PersistentClazz.AssemblyQualifiedName, StringHelper.GetClassname(className) );
}
}
|