From: Michael D. <mik...@us...> - 2004-12-16 04:54:22
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Cfg In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31421/NHibernate/Cfg Modified Files: Binder.cs Configuration.cs Mappings.cs Log Message: Some exception handling clean up. Index: Mappings.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Cfg/Mappings.cs,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Mappings.cs 29 Oct 2004 05:58:06 -0000 1.9 --- Mappings.cs 16 Dec 2004 04:54:07 -0000 1.10 *************** *** 84,94 **** /// <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); } --- 84,99 ---- /// <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> + /// <exception cref="MappingException">Thrown when the rename already identifies another Class.</exception> public void AddImport(string className, string rename) { ! // if the imports dictionary already contains the rename, then make sure ! // the rename is not for a different className. If it is a different className ! // then we probably have 2 classes with the same name in a different namespace. To ! // prevent this error one of the classes needs to have the attribute " ! if( imports.Contains(rename) && (string)imports[rename]!=className ) { throw new MappingException("duplicate import: " + rename); } ! imports[rename] = className; } *************** *** 148,161 **** } public bool IsAutoImport { ! get ! { ! return autoImport; ! } ! set ! { ! autoImport = value; ! } } } --- 153,172 ---- } + /// <summary> + /// Gets or sets a boolean indicating if the Fully Qualified Type name should + /// automattically have an import added as the class name. + /// </summary> + /// <value><c>true</c> if the class name should be used as an import.</value> + /// <remarks> + /// AutoImport is used to shorten the string used to refer to Types to just their + /// class. So if the type <c>MyAssembly.MyNamespace.MyClass, MyAssembly</c> has an <c>auto-import="false"</c> + /// then all use of in HQL would need to be the fully qualified version <c>MyAssembly.MyNamespace.MyClass</c>. + /// If <c>auto-import="true"</c> the the Type could be referred to in hql by just the class + /// name of <c>MyClass</c>. + /// </remarks> public bool IsAutoImport { ! get { return autoImport; } ! set { autoImport = value; } } } Index: Binder.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Cfg/Binder.cs,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** Binder.cs 10 Dec 2004 16:40:04 -0000 1.34 --- Binder.cs 16 Dec 2004 04:54:06 -0000 1.35 *************** *** 34,38 **** catch ( Exception cnfe ) { ! throw new MappingException( "persistent class not found", cnfe); } --- 34,38 ---- catch ( Exception cnfe ) { ! throw new MappingException( "persistent class not found", cnfe ); } *************** *** 47,51 **** catch (Exception cnfe) { ! throw new MappingException(cnfe); } } --- 47,51 ---- catch (Exception cnfe) { ! throw new MappingException( "proxy class not found", cnfe ); } } *************** *** 1106,1111 **** BindValue(subnode, key, model.IsOneToMany, Mapping.Collection.DefaultKeyColumnName); key.Type = model.Owner.Identifier.Type; ! if ( key.Type.ReturnedClass.IsArray ) throw new MappingException( ! "illegal use of an array as an identifier (arrays don't reimplement equals)"); model.Key = key; } --- 1106,1113 ---- BindValue(subnode, key, model.IsOneToMany, Mapping.Collection.DefaultKeyColumnName); key.Type = model.Owner.Identifier.Type; ! if ( key.Type.ReturnedClass.IsArray ) ! { ! throw new MappingException("illegal use of an array as an identifier (arrays don't reimplement equals)"); ! } model.Key = key; } *************** *** 1242,1247 **** { XmlAttribute extendsAttr = subnode.Attributes["extends"]; ! if( extendsAttr == null ) throw new MappingException( "'extends' attribute is not found." ); String extendsValue = extendsAttr.Value; System.Type superclass; --- 1244,1251 ---- { XmlAttribute extendsAttr = subnode.Attributes["extends"]; ! if( extendsAttr==null ) ! { throw new MappingException( "'extends' attribute is not found." ); + } String extendsValue = extendsAttr.Value; System.Type superclass; Index: Configuration.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Cfg/Configuration.cs,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** Configuration.cs 4 Dec 2004 22:41:18 -0000 1.24 --- Configuration.cs 16 Dec 2004 04:54:07 -0000 1.25 *************** *** 310,314 **** { log.Error("Could not configure datastore from assembly", e); ! throw new MappingException(e); } --- 310,314 ---- { log.Error("Could not configure datastore from assembly", e); ! throw new MappingException( "Could not add assembly named: " + assemblyName, e ); } |