From: Peter S. <sz...@us...> - 2004-09-13 12:48:12
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.Tool.hbm2net In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12414 Modified Files: AbstractRenderer.cs AssemblyInfo.cs BasicRenderer.cs ClassMapping.cs ClassName.cs CodeGenerator.cs DOMRenderer.cs FieldProperty.cs Log Message: Reordered the code a bit Index: CodeGenerator.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Tool.hbm2net/CodeGenerator.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** CodeGenerator.cs 25 Jul 2004 11:49:39 -0000 1.2 --- CodeGenerator.cs 13 Sep 2004 12:47:59 -0000 1.3 *************** *** 1,5 **** using System; ! using MappingException = NHibernate.MappingException; ! using MultiHashMap = System.Collections.Hashtable; using MultiMap = System.Collections.Hashtable; --- 1,9 ---- using System; ! using System.Collections; ! using System.IO; ! using System.Reflection; ! using System.Xml; ! using log4net; ! using log4net.Config; using MultiHashMap = System.Collections.Hashtable; using MultiMap = System.Collections.Hashtable; *************** *** 14,40 **** public class CodeGenerator { ! private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); ! internal static System.Xml.XmlNamespaceManager nsmgr; [STAThread] ! public static void Main(System.String[] args) { ! nsmgr = new System.Xml.XmlNamespaceManager(new System.Xml.NameTable()); nsmgr.AddNamespace("urn", "urn:nhibernate-mapping-2.0"); ! System.IO.File.Delete("error-log.txt"); ! log4net.Config.DOMConfigurator.Configure(new System.IO.FileInfo("NHibernate.Tool.hbm2net.exe.config")); if (args.Length == 0) { ! System.Console.Error.WriteLine("No arguments provided. Nothing to do. Exit."); ! System.Environment.Exit(- 1); } try { ! System.Collections.ArrayList mappingFiles = new System.Collections.ArrayList(); ! System.String outputDir = null; SupportClass.ListCollectionSupport generators = new SupportClass.ListCollectionSupport(); --- 18,44 ---- public class CodeGenerator { ! private static readonly ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); ! internal static XmlNamespaceManager nsmgr; [STAThread] ! public static void Main(String[] args) { ! nsmgr = new XmlNamespaceManager(new NameTable()); nsmgr.AddNamespace("urn", "urn:nhibernate-mapping-2.0"); ! File.Delete("error-log.txt"); ! DOMConfigurator.Configure(new FileInfo("NHibernate.Tool.hbm2net.exe.config")); if (args.Length == 0) { ! Console.Error.WriteLine("No arguments provided. Nothing to do. Exit."); ! Environment.Exit(- 1); } try { ! ArrayList mappingFiles = new ArrayList(); ! String outputDir = null; SupportClass.ListCollectionSupport generators = new SupportClass.ListCollectionSupport(); *************** *** 50,57 **** { // parse config xml file ! Document document = new System.Xml.XmlDocument(); document.Load(args[i].Substring(9)); ! globalMetas = MetaAttributeHelper.loadAndMergeMetaMap((System.Xml.XmlElement)(document["codegen"]), null); ! System.Collections.IEnumerator generateElements = document["codegen"].SelectNodes("generate").GetEnumerator(); while (generateElements.MoveNext()) --- 54,61 ---- { // parse config xml file ! Document document = new XmlDocument(); document.Load(args[i].Substring(9)); ! globalMetas = MetaAttributeHelper.loadAndMergeMetaMap((document["codegen"]), null); ! IEnumerator generateElements = document["codegen"].SelectNodes("generate").GetEnumerator(); while (generateElements.MoveNext()) *************** *** 77,82 **** } ! System.Collections.Hashtable classMappings = new System.Collections.Hashtable(); ! for (System.Collections.IEnumerator iter = mappingFiles.GetEnumerator(); iter.MoveNext(); ) { try --- 81,86 ---- } ! Hashtable classMappings = new Hashtable(); ! for (IEnumerator iter = mappingFiles.GetEnumerator(); iter.MoveNext(); ) { try *************** *** 84,91 **** log.Info(iter.Current.ToString()); // parse the mapping file ! System.Xml.NameTable nt = new System.Xml.NameTable(); nt.Add("urn:nhibernate-mapping-2.0"); ! Document document = new System.Xml.XmlDocument(nt); ! document.Load((System.String) iter.Current); Element rootElement = document["hibernate-mapping"]; --- 88,95 ---- log.Info(iter.Current.ToString()); // parse the mapping file ! NameTable nt = new NameTable(); nt.Add("urn:nhibernate-mapping-2.0"); ! Document document = new XmlDocument(nt); ! document.Load((String) iter.Current); Element rootElement = document["hibernate-mapping"]; *************** *** 94,99 **** continue; ! System.Xml.XmlAttribute a = rootElement.Attributes["package"]; ! System.String pkg = null; if (a != null) { --- 98,103 ---- continue; ! XmlAttribute a = rootElement.Attributes["package"]; ! String pkg = null; if (a != null) { *************** *** 101,105 **** } MappingElement me = new MappingElement(rootElement, null); ! System.Collections.IEnumerator classElements = rootElement.SelectNodes("urn:class", nsmgr).GetEnumerator(); MultiMap mm = MetaAttributeHelper.loadAndMergeMetaMap(rootElement, globalMetas); handleClass(pkg, me, classMappings, classElements, mm, false); --- 105,109 ---- } MappingElement me = new MappingElement(rootElement, null); ! IEnumerator classElements = rootElement.SelectNodes("urn:class", nsmgr).GetEnumerator(); MultiMap mm = MetaAttributeHelper.loadAndMergeMetaMap(rootElement, globalMetas); handleClass(pkg, me, classMappings, classElements, mm, false); *************** *** 117,121 **** } // generate source files ! for (System.Collections.IEnumerator iterator = generators.GetEnumerator(); iterator.MoveNext(); ) { Generator g = (Generator) iterator.Current; --- 121,125 ---- } // generate source files ! for (IEnumerator iterator = generators.GetEnumerator(); iterator.MoveNext(); ) { Generator g = (Generator) iterator.Current; *************** *** 124,128 **** } } ! catch (System.Exception e) { SupportClass.WriteStackTrace(e, Console.Error); --- 128,132 ---- } } ! catch (Exception e) { SupportClass.WriteStackTrace(e, Console.Error); *************** *** 130,134 **** } ! private static void handleClass(System.String classPackage, MappingElement me, System.Collections.Hashtable classMappings, System.Collections.IEnumerator classElements, MultiMap mm, bool extendz) { while (classElements.MoveNext()) --- 134,138 ---- } ! private static void handleClass(String classPackage, MappingElement me, Hashtable classMappings, IEnumerator classElements, MultiMap mm, bool extendz) { while (classElements.MoveNext()) *************** *** 143,148 **** else { ! System.String ex = (clazz.Attributes["extends"] == null?null:clazz.Attributes["extends"].Value); ! if ((System.Object) ex == null) { throw new MappingException("Missing extends attribute on <" + clazz.LocalName + " name=" + clazz.Attributes["name"].Value + ">"); --- 147,152 ---- else { ! String ex = (clazz.Attributes["extends"] == null?null:clazz.Attributes["extends"].Value); ! if ((Object) ex == null) { throw new MappingException("Missing extends attribute on <" + clazz.LocalName + " name=" + clazz.Attributes["name"].Value + ">"); Index: DOMRenderer.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Tool.hbm2net/DOMRenderer.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** DOMRenderer.cs 25 Jul 2004 11:41:03 -0000 1.1 --- DOMRenderer.cs 13 Sep 2004 12:47:59 -0000 1.2 *************** *** 1,5 **** using System; ! using System.CodeDom; ! using System.CodeDom.Compiler; namespace NHibernate.Tool.hbm2net --- 1,5 ---- using System; ! using System.Collections; ! using System.IO; namespace NHibernate.Tool.hbm2net *************** *** 10,14 **** public class DOMRenderer : AbstractRenderer { ! public override void render(String savedToPackage, String savedToClass, ClassMapping classMapping, System.Collections.IDictionary class2classmap, System.IO.StreamWriter writer) { } --- 10,14 ---- public class DOMRenderer : AbstractRenderer { ! public override void render(String savedToPackage, String savedToClass, ClassMapping classMapping, IDictionary class2classmap, StreamWriter writer) { } Index: ClassMapping.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Tool.hbm2net/ClassMapping.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ClassMapping.cs 25 Jul 2004 11:41:03 -0000 1.1 --- ClassMapping.cs 13 Sep 2004 12:47:59 -0000 1.2 *************** *** 1,14 **** using System; using CompositeUserType = NHibernate.ICompositeUserType; using UserType = NHibernate.IUserType; - using PrimitiveType = NHibernate.Type.PrimitiveType; using Type = NHibernate.Type.TypeType; - using TypeFactory = NHibernate.Type.TypeFactory; - using ReflectHelper = NHibernate.Util.ReflectHelper; - using StringHelper = NHibernate.Util.StringHelper; using Element = System.Xml.XmlElement; using MultiMap = System.Collections.Hashtable; - using System.Xml; - using IType = NHibernate.Type.IType; namespace NHibernate.Tool.hbm2net --- 1,15 ---- using System; + using System.Collections; + using System.IO; + using System.Reflection; + using System.Xml; + using log4net; + using NHibernate.Type; + using NHibernate.Util; using CompositeUserType = NHibernate.ICompositeUserType; using UserType = NHibernate.IUserType; using Type = NHibernate.Type.TypeType; using Element = System.Xml.XmlElement; using MultiMap = System.Collections.Hashtable; namespace NHibernate.Tool.hbm2net *************** *** 18,22 **** public class ClassMapping:MappingElement { ! private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); private void InitBlock() --- 19,23 ---- public class ClassMapping:MappingElement { ! private static readonly ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private void InitBlock() *************** *** 44,48 **** } /// <summary>shorthand method for getClassName().getFullyQualifiedName() </summary> ! virtual public System.String FullyQualifiedName { get --- 45,49 ---- } /// <summary>shorthand method for getClassName().getFullyQualifiedName() </summary> ! virtual public String FullyQualifiedName { get *************** *** 53,57 **** } /// <summary>shorthand method for getClassName().getName() </summary> ! virtual public System.String Name { get --- 54,58 ---- } /// <summary>shorthand method for getClassName().getName() </summary> ! virtual public String Name { get *************** *** 62,66 **** } /// <summary>shorthand method for getClassName().getPackageName() </summary> ! virtual public System.String PackageName { get --- 63,67 ---- } /// <summary>shorthand method for getClassName().getPackageName() </summary> ! virtual public String PackageName { get *************** *** 78,82 **** } ! virtual public System.String GeneratedName { get --- 79,83 ---- } ! virtual public String GeneratedName { get *************** *** 86,90 **** } ! virtual public System.String GeneratedPackageName { get --- 87,91 ---- } ! virtual public String GeneratedPackageName { get *************** *** 94,98 **** } ! virtual public System.String Proxy { get --- 95,99 ---- } ! virtual public String Proxy { get *************** *** 110,114 **** } ! virtual public System.String SuperClass { get --- 111,115 ---- } ! virtual public String SuperClass { get *************** *** 123,127 **** { SupportClass.ListCollectionSupport result = new SupportClass.ListCollectionSupport(); ! for (System.Collections.IEnumerator myFields = Fields.GetEnumerator(); myFields.MoveNext(); ) { FieldProperty field = (FieldProperty) myFields.Current; --- 124,128 ---- { SupportClass.ListCollectionSupport result = new SupportClass.ListCollectionSupport(); ! for (IEnumerator myFields = Fields.GetEnumerator(); myFields.MoveNext(); ) { FieldProperty field = (FieldProperty) myFields.Current; *************** *** 159,163 **** { SupportClass.ListCollectionSupport result = new SupportClass.ListCollectionSupport(); ! for (System.Collections.IEnumerator myFields = Fields.GetEnumerator(); myFields.MoveNext(); ) { FieldProperty field = (FieldProperty) myFields.Current; --- 160,164 ---- { SupportClass.ListCollectionSupport result = new SupportClass.ListCollectionSupport(); ! for (IEnumerator myFields = Fields.GetEnumerator(); myFields.MoveNext(); ) { FieldProperty field = (FieldProperty) myFields.Current; *************** *** 229,233 **** } ! public static System.Collections.IEnumerator Components { get --- 230,234 ---- } ! public static IEnumerator Components { get *************** *** 258,266 **** /// <returns> /// </returns> ! virtual public System.String Scope { get { ! System.String classScope = "public"; if (getMeta("scope-class") != null) { --- 259,267 ---- /// <returns> /// </returns> ! virtual public String Scope { get { ! String classScope = "public"; if (getMeta("scope-class") != null) { *************** *** 273,277 **** /// <returns> /// </returns> ! virtual public System.String DeclarationType { get --- 274,278 ---- /// <returns> /// </returns> ! virtual public String DeclarationType { get *************** *** 294,298 **** /// <returns> /// </returns> ! virtual public System.String Modifiers { get --- 295,299 ---- /// <returns> /// </returns> ! virtual public String Modifiers { get *************** *** 322,337 **** private ClassName name = null; private ClassName generatedName = null; ! private System.String superClass = null; private ClassMapping superClassMapping = null; ! private System.String proxyClass = null; private SupportClass.ListCollectionSupport fields; private SupportClass.TreeSetSupport imports; private SupportClass.ListCollectionSupport subclasses; ! private static readonly System.Collections.IDictionary components = new System.Collections.Hashtable(); private bool mustImplementEquals_Renamed_Field = false; private bool shouldBeAbstract_Renamed_Field = false; ! public ClassMapping(System.String classPackage, MappingElement parentElement, ClassName superClass, ClassMapping superClassMapping, Element classElement, MultiMap inheritedMeta):this(classPackage, parentElement, superClass, classElement, inheritedMeta) { --- 323,338 ---- private ClassName name = null; private ClassName generatedName = null; ! private String superClass = null; private ClassMapping superClassMapping = null; ! private String proxyClass = null; private SupportClass.ListCollectionSupport fields; private SupportClass.TreeSetSupport imports; private SupportClass.ListCollectionSupport subclasses; ! private static readonly IDictionary components = new Hashtable(); private bool mustImplementEquals_Renamed_Field = false; private bool shouldBeAbstract_Renamed_Field = false; ! public ClassMapping(String classPackage, MappingElement parentElement, ClassName superClass, ClassMapping superClassMapping, Element classElement, MultiMap inheritedMeta):this(classPackage, parentElement, superClass, classElement, inheritedMeta) { *************** *** 341,345 **** { SupportClass.ListCollectionSupport l = this.superClassMapping.AllFieldsForFullConstructor; ! for (System.Collections.IEnumerator iter = l.GetEnumerator(); iter.MoveNext(); ) { FieldProperty element = (FieldProperty) iter.Current; --- 342,346 ---- { SupportClass.ListCollectionSupport l = this.superClassMapping.AllFieldsForFullConstructor; ! for (IEnumerator iter = l.GetEnumerator(); iter.MoveNext(); ) { FieldProperty element = (FieldProperty) iter.Current; *************** *** 358,362 **** } ! public ClassMapping(System.String classPackage, MappingElement parentElement, ClassName superClass, Element classElement, MultiMap inheritedMeta):base(classElement, parentElement) { InitBlock(); --- 359,363 ---- } ! public ClassMapping(String classPackage, MappingElement parentElement, ClassName superClass, Element classElement, MultiMap inheritedMeta):base(classElement, parentElement) { InitBlock(); *************** *** 364,368 **** } ! public ClassMapping(System.String classPackage, Element classElement, MappingElement parentElement, MultiMap inheritedMeta):base(classElement, parentElement) { InitBlock(); --- 365,369 ---- } ! public ClassMapping(String classPackage, Element classElement, MappingElement parentElement, MultiMap inheritedMeta):base(classElement, parentElement) { InitBlock(); *************** *** 370,374 **** } ! public ClassMapping(System.String classPackage, Element classElement, MappingElement parentElement, bool component, MultiMap inheritedMeta):base(classElement, parentElement) { InitBlock(); --- 371,375 ---- } ! public ClassMapping(String classPackage, Element classElement, MappingElement parentElement, bool component, MultiMap inheritedMeta):base(classElement, parentElement) { InitBlock(); *************** *** 376,385 **** } ! protected internal virtual void initWith(System.String classPackage, ClassName mySuperClass, Element classElement, bool component, MultiMap inheritedMeta) { ! System.String fullyQualifiedName = (classElement.Attributes[component?"class":"name"] == null?string.Empty:classElement.Attributes[component?"class":"name"].Value); ! if (fullyQualifiedName.IndexOf((System.Char) '.') < 0 && (System.Object) classPackage != null && classPackage.Trim().Length > 0) { fullyQualifiedName = classPackage + "." + fullyQualifiedName; --- 377,386 ---- } ! protected internal virtual void initWith(String classPackage, ClassName mySuperClass, Element classElement, bool component, MultiMap inheritedMeta) { ! String fullyQualifiedName = (classElement.Attributes[component?"class":"name"] == null?string.Empty:classElement.Attributes[component?"class":"name"].Value); ! if (fullyQualifiedName.IndexOf('.') < 0 && (Object) classPackage != null && classPackage.Trim().Length > 0) { fullyQualifiedName = classPackage + "." + fullyQualifiedName; *************** *** 444,450 **** { implementEquals(); ! System.String cmpname = (cmpid.Attributes["name"] == null?null:cmpid.Attributes["name"].Value); ! System.String cmpclass = (cmpid.Attributes["class"] == null?null:cmpid.Attributes["class"].Value); ! if ((System.Object) cmpclass == null || cmpclass.Equals(string.Empty)) { //Embedded composite id --- 445,451 ---- { implementEquals(); ! String cmpname = (cmpid.Attributes["name"] == null?null:cmpid.Attributes["name"].Value); ! String cmpclass = (cmpid.Attributes["class"] == null?null:cmpid.Attributes["class"].Value); ! if ((Object) cmpclass == null || cmpclass.Equals(string.Empty)) { //Embedded composite id *************** *** 467,471 **** tempObject = mapping; components[mapping.FullyQualifiedName] = tempObject; - System.Object generatedAux = tempObject; } } --- 468,471 ---- *************** *** 478,488 **** // derive the class imports and fields from the properties ! for (System.Collections.IEnumerator properties = propertyList.GetEnumerator(); properties.MoveNext(); ) { Element property = (Element) properties.Current; MultiMap metaForProperty = MetaAttributeHelper.loadAndMergeMetaMap(property, MetaAttribs); ! System.String propertyName = (property.Attributes["name"] == null?null:property.Attributes["name"].Value); ! if ((System.Object) propertyName == null || propertyName.Trim().Equals(string.Empty)) { continue; //since an id doesn't necessarily need a name --- 478,488 ---- // derive the class imports and fields from the properties ! for (IEnumerator properties = propertyList.GetEnumerator(); properties.MoveNext(); ) { Element property = (Element) properties.Current; MultiMap metaForProperty = MetaAttributeHelper.loadAndMergeMetaMap(property, MetaAttribs); ! String propertyName = (property.Attributes["name"] == null?null:property.Attributes["name"].Value); ! if ((Object) propertyName == null || propertyName.Trim().Equals(string.Empty)) { continue; //since an id doesn't necessarily need a name *************** *** 490,495 **** // ensure that the type is specified ! System.String type = (property.Attributes["type"] == null?null:property.Attributes["type"].Value); ! if ((System.Object) type == null && cmpid != null) { // for composite-keys --- 490,495 ---- // ensure that the type is specified ! String type = (property.Attributes["type"] == null?null:property.Attributes["type"].Value); ! if ((Object) type == null && cmpid != null) { // for composite-keys *************** *** 506,510 **** } ! if ((System.Object) type == null || type.Trim().Equals(string.Empty)) { if (property == id) --- 506,510 ---- } ! if ((Object) type == null || type.Trim().Equals(string.Empty)) { if (property == id) *************** *** 523,528 **** { Element generator = property["generator"]; ! System.String unsavedValue = (property.Attributes["unsaved-value"] == null?null:property.Attributes["unsaved-value"].Value); ! bool mustBeNullable = ((System.Object) unsavedValue != null && unsavedValue.Equals("null")); bool generated = !(generator.Attributes["class"] == null?string.Empty:generator.Attributes["class"].Value).Equals("assigned"); ClassName rtype = getFieldType(type, mustBeNullable, false); --- 523,528 ---- { Element generator = property["generator"]; ! String unsavedValue = (property.Attributes["unsaved-value"] == null?null:property.Attributes["unsaved-value"].Value); ! bool mustBeNullable = ((Object) unsavedValue != null && unsavedValue.Equals("null")); bool generated = !(generator.Attributes["class"] == null?string.Empty:generator.Attributes["class"].Value).Equals("assigned"); ClassName rtype = getFieldType(type, mustBeNullable, false); *************** *** 533,540 **** else { ! System.String notnull = (property.Attributes["not-null"] == null?null:property.Attributes["not-null"].Value); // if not-null property is missing lets see if it has been // defined at column level ! if ((System.Object) notnull == null) { Element column = property["column"]; --- 533,540 ---- else { ! String notnull = (property.Attributes["not-null"] == null?null:property.Attributes["not-null"].Value); // if not-null property is missing lets see if it has been // defined at column level ! if ((Object) notnull == null) { Element column = property["column"]; *************** *** 542,546 **** notnull = (column.Attributes["not-null"] == null?null:column.Attributes["not-null"].Value); } ! bool nullable = ((System.Object) notnull == null || notnull.Equals("false")); bool key = property.LocalName.StartsWith("key-"); //a composite id property ClassName t = getFieldType(type); --- 542,546 ---- notnull = (column.Attributes["not-null"] == null?null:column.Attributes["not-null"].Value); } ! bool nullable = ((Object) notnull == null || notnull.Equals("false")); bool key = property.LocalName.StartsWith("key-"); //a composite id property ClassName t = getFieldType(type); *************** *** 552,564 **** // one to ones ! for (System.Collections.IEnumerator onetoones = classElement.SelectNodes("urn:one-to-one", CodeGenerator.nsmgr).GetEnumerator(); onetoones.MoveNext(); ) { Element onetoone = (Element) onetoones.Current; MultiMap metaForOneToOne = MetaAttributeHelper.loadAndMergeMetaMap(onetoone, MetaAttribs); ! System.String propertyName = (onetoone.Attributes["name"] == null?string.Empty:onetoone.Attributes["name"].Value); // ensure that the class is specified ! System.String clazz = (onetoone.Attributes["class"] == null?string.Empty:onetoone.Attributes["class"].Value); if (clazz.Length == 0) { --- 552,564 ---- // one to ones ! for (IEnumerator onetoones = classElement.SelectNodes("urn:one-to-one", CodeGenerator.nsmgr).GetEnumerator(); onetoones.MoveNext(); ) { Element onetoone = (Element) onetoones.Current; MultiMap metaForOneToOne = MetaAttributeHelper.loadAndMergeMetaMap(onetoone, MetaAttribs); ! String propertyName = (onetoone.Attributes["name"] == null?string.Empty:onetoone.Attributes["name"].Value); // ensure that the class is specified ! String clazz = (onetoone.Attributes["class"] == null?string.Empty:onetoone.Attributes["class"].Value); if (clazz.Length == 0) { *************** *** 573,585 **** // many to ones - TODO: consolidate with code above ! for (System.Collections.IEnumerator manytoOnes = manyToOneList.GetEnumerator(); manytoOnes.MoveNext(); ) { Element manyToOne = (Element) manytoOnes.Current; MultiMap metaForManyToOne = MetaAttributeHelper.loadAndMergeMetaMap(manyToOne, MetaAttribs); ! System.String propertyName = (manyToOne.Attributes["name"] == null?string.Empty:manyToOne.Attributes["name"].Value); // ensure that the type is specified ! System.String type = (manyToOne.Attributes["class"] == null?string.Empty:manyToOne.Attributes["class"].Value); if (type.Length == 0) { --- 573,585 ---- // many to ones - TODO: consolidate with code above ! for (IEnumerator manytoOnes = manyToOneList.GetEnumerator(); manytoOnes.MoveNext(); ) { Element manyToOne = (Element) manytoOnes.Current; MultiMap metaForManyToOne = MetaAttributeHelper.loadAndMergeMetaMap(manyToOne, MetaAttribs); ! String propertyName = (manyToOne.Attributes["name"] == null?string.Empty:manyToOne.Attributes["name"].Value); // ensure that the type is specified ! String type = (manyToOne.Attributes["class"] == null?string.Empty:manyToOne.Attributes["class"].Value); if (type.Length == 0) { *************** *** 590,595 **** // is it nullable? ! System.String notnull = (manyToOne.Attributes["not-null"] == null?null:manyToOne.Attributes["not-null"].Value); ! bool nullable = ((System.Object) notnull == null || notnull.Equals("false")); bool key = manyToOne.LocalName.StartsWith("key-"); //a composite id property --- 590,595 ---- // is it nullable? ! String notnull = (manyToOne.Attributes["not-null"] == null?null:manyToOne.Attributes["not-null"].Value); ! bool nullable = ((Object) notnull == null || notnull.Equals("false")); bool key = manyToOne.LocalName.StartsWith("key-"); //a composite id property *************** *** 614,624 **** //components ! for (System.Collections.IEnumerator iter = classElement.SelectNodes("urn:component", CodeGenerator.nsmgr).GetEnumerator(); iter.MoveNext(); ) { Element cmpe = (Element) iter.Current; MultiMap metaForComponent = MetaAttributeHelper.loadAndMergeMetaMap(cmpe, MetaAttribs); ! System.String cmpname = (cmpe.Attributes["name"] == null?null:cmpe.Attributes["name"].Value); ! System.String cmpclass = (cmpe.Attributes["class"] == null?null:cmpe.Attributes["class"].Value); ! if ((System.Object) cmpclass == null || cmpclass.Equals(string.Empty)) { log.Warn("component \"" + cmpname + "\" in class " + Name + " does not specify a class"); --- 614,624 ---- //components ! for (IEnumerator iter = classElement.SelectNodes("urn:component", CodeGenerator.nsmgr).GetEnumerator(); iter.MoveNext(); ) { Element cmpe = (Element) iter.Current; MultiMap metaForComponent = MetaAttributeHelper.loadAndMergeMetaMap(cmpe, MetaAttribs); ! String cmpname = (cmpe.Attributes["name"] == null?null:cmpe.Attributes["name"].Value); ! String cmpclass = (cmpe.Attributes["class"] == null?null:cmpe.Attributes["class"].Value); ! if ((Object) cmpclass == null || cmpclass.Equals(string.Empty)) { log.Warn("component \"" + cmpname + "\" in class " + Name + " does not specify a class"); *************** *** 635,639 **** tempObject2 = mapping; components[mapping.FullyQualifiedName] = tempObject2; - System.Object generatedAux2 = tempObject2; } --- 635,638 ---- *************** *** 641,645 **** // subclasses (done last so they can access this superclass for info) ! for (System.Collections.IEnumerator iter = classElement.SelectNodes("urn:subclass", CodeGenerator.nsmgr).GetEnumerator(); iter.MoveNext(); ) { Element subclass = (Element) iter.Current; --- 640,644 ---- // subclasses (done last so they can access this superclass for info) ! for (IEnumerator iter = classElement.SelectNodes("urn:subclass", CodeGenerator.nsmgr).GetEnumerator(); iter.MoveNext(); ) { Element subclass = (Element) iter.Current; *************** *** 648,652 **** } ! for (System.Collections.IEnumerator iter = classElement.SelectNodes("urn:joined-subclass", CodeGenerator.nsmgr).GetEnumerator(); iter.MoveNext(); ) { Element subclass = (Element) iter.Current; --- 647,651 ---- } ! for (IEnumerator iter = classElement.SelectNodes("urn:joined-subclass", CodeGenerator.nsmgr).GetEnumerator(); iter.MoveNext(); ) { Element subclass = (Element) iter.Current; *************** *** 667,671 **** else { ! throw new System.SystemException("Field " + fieldProperty + " is already associated with a class: " + fieldProperty.ParentClass); } } --- 666,670 ---- else { ! throw new SystemException("Field " + fieldProperty + " is already associated with a class: " + fieldProperty.ParentClass); } } *************** *** 711,715 **** } ! public virtual void addImport(System.String className) { ClassName cn = new ClassName(className); --- 710,714 ---- } ! public virtual void addImport(String className) { ClassName cn = new ClassName(className); *************** *** 717,747 **** } ! private void doCollections(System.String classPackage, Element classElement, System.String xmlName, System.String interfaceClass, System.String implementingClass, MultiMap inheritedMeta) { ! System.String originalInterface = interfaceClass; ! System.String originalImplementation = implementingClass; ! for (System.Collections.IEnumerator collections = classElement.SelectNodes("urn:" + xmlName, CodeGenerator.nsmgr).GetEnumerator(); collections.MoveNext(); ) { Element collection = (Element) collections.Current; MultiMap metaForCollection = MetaAttributeHelper.loadAndMergeMetaMap(collection, inheritedMeta); ! System.String propertyName = (collection.Attributes["name"] == null?string.Empty:collection.Attributes["name"].Value); //TODO: map and set in .net // Small hack to switch over to sortedSet/sortedMap if sort is specified. (that is sort != unsorted) ! System.String sortValue = (collection.Attributes["sort"] == null?null:collection.Attributes["sort"].Value); ! if ((System.Object) sortValue != null && !"unsorted".Equals(sortValue) && !"".Equals(sortValue.Trim())) { if ("map".Equals(xmlName)) { ! interfaceClass = typeof(System.Collections.IDictionary).FullName; ! implementingClass = typeof(System.Collections.IDictionary).FullName; } else if ("set".Equals(xmlName)) { ! interfaceClass = typeof(System.Collections.IDictionary).FullName; ! implementingClass = typeof(System.Collections.IDictionary).FullName; } } --- 716,746 ---- } ! private void doCollections(String classPackage, Element classElement, String xmlName, String interfaceClass, String implementingClass, MultiMap inheritedMeta) { ! String originalInterface = interfaceClass; ! String originalImplementation = implementingClass; ! for (IEnumerator collections = classElement.SelectNodes("urn:" + xmlName, CodeGenerator.nsmgr).GetEnumerator(); collections.MoveNext(); ) { Element collection = (Element) collections.Current; MultiMap metaForCollection = MetaAttributeHelper.loadAndMergeMetaMap(collection, inheritedMeta); ! String propertyName = (collection.Attributes["name"] == null?string.Empty:collection.Attributes["name"].Value); //TODO: map and set in .net // Small hack to switch over to sortedSet/sortedMap if sort is specified. (that is sort != unsorted) ! String sortValue = (collection.Attributes["sort"] == null?null:collection.Attributes["sort"].Value); ! if ((Object) sortValue != null && !"unsorted".Equals(sortValue) && !"".Equals(sortValue.Trim())) { if ("map".Equals(xmlName)) { ! interfaceClass = typeof(IDictionary).FullName; ! implementingClass = typeof(IDictionary).FullName; } else if ("set".Equals(xmlName)) { ! interfaceClass = typeof(IDictionary).FullName; ! implementingClass = typeof(IDictionary).FullName; } } *************** *** 783,787 **** foreignKeys.Add(collection["key"].Attributes["column"].Value); ! for (System.Collections.IEnumerator iter = collection["key"].SelectNodes("urn:column", CodeGenerator.nsmgr).GetEnumerator(); iter.MoveNext(); ) { if (((Element) iter.Current).Attributes["name"] != null) --- 782,786 ---- foreignKeys.Add(collection["key"].Attributes["column"].Value); ! for (IEnumerator iter = collection["key"].SelectNodes("urn:column", CodeGenerator.nsmgr).GetEnumerator(); iter.MoveNext(); ) { if (((Element) iter.Current).Attributes["name"] != null) *************** *** 795,802 **** if (collection.SelectNodes("urn:composite-element", CodeGenerator.nsmgr).Count != 0) { ! for (System.Collections.IEnumerator compositeElements = collection.SelectNodes("urn:composite-element", CodeGenerator.nsmgr).GetEnumerator(); compositeElements.MoveNext(); ) { Element compositeElement = (Element) compositeElements.Current; ! System.String compClass = compositeElement.Attributes["class"].Value; try --- 794,801 ---- if (collection.SelectNodes("urn:composite-element", CodeGenerator.nsmgr).Count != 0) { ! for (IEnumerator compositeElements = collection.SelectNodes("urn:composite-element", CodeGenerator.nsmgr).GetEnumerator(); compositeElements.MoveNext(); ) { Element compositeElement = (Element) compositeElements.Current; ! String compClass = compositeElement.Attributes["class"].Value; try *************** *** 809,815 **** tempObject = mapping; components[mapping.FullyQualifiedName] = tempObject; - System.Object generatedAux = tempObject; } ! catch (System.Exception e) { log.Error("Error building composite-element " + compClass, e); --- 808,813 ---- tempObject = mapping; components[mapping.FullyQualifiedName] = tempObject; } ! catch (Exception e) { log.Error("Error building composite-element " + compClass, e); *************** *** 820,832 **** } ! private void doArrays(Element classElement, System.String type, MultiMap inheritedMeta) { ! for (System.Collections.IEnumerator arrays = classElement.SelectNodes(type).GetEnumerator(); arrays.MoveNext(); ) { Element array = (Element) arrays.Current; MultiMap metaForArray = MetaAttributeHelper.loadAndMergeMetaMap(array, inheritedMeta); ! System.String role = array.Attributes["name"].Value; ! System.String elementClass = (array.Attributes["element-class"] == null?null:array.Attributes["element-class"].Value); ! if ((System.Object) elementClass == null) { Element elt = array["element"]; --- 818,830 ---- } ! private void doArrays(Element classElement, String type, MultiMap inheritedMeta) { ! for (IEnumerator arrays = classElement.SelectNodes(type).GetEnumerator(); arrays.MoveNext(); ) { Element array = (Element) arrays.Current; MultiMap metaForArray = MetaAttributeHelper.loadAndMergeMetaMap(array, inheritedMeta); ! String role = array.Attributes["name"].Value; ! String elementClass = (array.Attributes["element-class"] == null?null:array.Attributes["element-class"].Value); ! if ((Object) elementClass == null) { Element elt = array["element"]; *************** *** 843,847 **** } elementClass = (elt.Attributes["type"] == null?null:elt.Attributes["type"].Value); ! if ((System.Object) elementClass == null) elementClass = (elt.Attributes["class"] == null?string.Empty:elt.Attributes["class"].Value); } --- 841,845 ---- } elementClass = (elt.Attributes["type"] == null?null:elt.Attributes["type"].Value); ! if ((Object) elementClass == null) elementClass = (elt.Attributes["class"] == null?string.Empty:elt.Attributes["class"].Value); } *************** *** 854,858 **** } ! private ClassName getFieldType(System.String hibernateType) { return getFieldType(hibernateType, false, false); --- 852,856 ---- } ! private ClassName getFieldType(String hibernateType) { return getFieldType(hibernateType, false, false); *************** *** 864,876 **** /// <param name="hibernateType">Name of the hibernatetype (e.g. "binary") /// </param> - /// <param name="needObject"> - /// </param> /// <param name="isArray">if the type should be postfixed with array brackes ("[]") /// </param> /// <returns> /// </returns> ! private ClassName getFieldType(System.String hibernateType, bool mustBeNullable, bool isArray) { ! System.String postfix = isArray?"[]":""; // deal with hibernate binary type ClassName cn = null; --- 862,873 ---- /// <param name="hibernateType">Name of the hibernatetype (e.g. "binary") /// </param> /// <param name="isArray">if the type should be postfixed with array brackes ("[]") /// </param> + /// <param name="mustBeNullable"></param> /// <returns> /// </returns> ! private ClassName getFieldType(String hibernateType, bool mustBeNullable, bool isArray) { ! String postfix = isArray?"[]":""; // deal with hibernate binary type ClassName cn = null; *************** *** 910,914 **** /// <summary>Returns name of returnedclass if type is an UserType *</summary> ! private System.String getTypeForUserType(System.String type) { System.Type clazz = null; --- 907,911 ---- /// <summary>Returns name of returnedclass if type is an UserType *</summary> ! private String getTypeForUserType(String type) { System.Type clazz = null; *************** *** 923,927 **** UserType ut = (UserType) SupportClass.CreateNewInstance(clazz); log.Debug("Resolved usertype: " + type + " to " + ut.ReturnedType.Name); ! System.String t = clazzToName(ut.ReturnedType); return t; } --- 920,924 ---- UserType ut = (UserType) SupportClass.CreateNewInstance(clazz); log.Debug("Resolved usertype: " + type + " to " + ut.ReturnedType.Name); ! String t = clazzToName(ut.ReturnedType); return t; } *************** *** 931,939 **** CompositeUserType ut = (CompositeUserType) SupportClass.CreateNewInstance(clazz); log.Debug("Resolved composite usertype: " + type + " to " + ut.ReturnedClass.Name); ! System.String t = clazzToName(ut.ReturnedClass); return t; } } ! catch (System.IO.FileNotFoundException e) { if (type.IndexOf(",")>0) --- 928,936 ---- CompositeUserType ut = (CompositeUserType) SupportClass.CreateNewInstance(clazz); log.Debug("Resolved composite usertype: " + type + " to " + ut.ReturnedClass.Name); ! String t = clazzToName(ut.ReturnedClass); return t; } } ! catch (FileNotFoundException e) { if (type.IndexOf(",")>0) *************** *** 941,949 **** log.Warn("Could not find UserType: " + type + ". Using the type '" + type + "' directly instead. (" + e.ToString() + ")"); } ! catch (System.UnauthorizedAccessException iae) { log.Warn("Error while trying to resolve UserType. Using the type '" + type + "' directly instead. (" + iae.ToString() + ")"); } ! catch (System.Exception e) { log.Warn("Error while trying to resolve UserType. Using the type '" + type + "' directly instead. (" + e.ToString() + ")"); --- 938,946 ---- log.Warn("Could not find UserType: " + type + ". Using the type '" + type + "' directly instead. (" + e.ToString() + ")"); } ! catch (UnauthorizedAccessException iae) { log.Warn("Error while trying to resolve UserType. Using the type '" + type + "' directly instead. (" + iae.ToString() + ")"); } ! catch (Exception e) { log.Warn("Error while trying to resolve UserType. Using the type '" + type + "' directly instead. (" + e.ToString() + ")"); *************** *** 953,959 **** } ! private System.String clazzToName(System.Type cl) { ! System.String s = null; if (cl.IsArray) --- 950,956 ---- } ! private String clazzToName(System.Type cl) { ! String s = null; if (cl.IsArray) *************** *** 982,986 **** { // Inform that "extends" is not used if this one is a genuine subclass ! if ((System.Object) SuperClass != null && getMeta("extends") != null) { log.Warn("Warning: meta attribute extends='" + getMetaAsString("extends") + "' will be ignored for subclass " + name); --- 979,983 ---- { // Inform that "extends" is not used if this one is a genuine subclass ! if ((Object) SuperClass != null && getMeta("extends") != null) { log.Warn("Warning: meta attribute extends='" + getMetaAsString("extends") + "' will be ignored for subclass " + name); *************** *** 988,1000 **** } ! /// <seealso cref="java.lang.Object#toString()"> ! /// </seealso> ! public override System.String ToString() { return "ClassMapping: " + name.FullyQualifiedName; } - /// <param name="">subclassMapping - /// </param> public virtual void addSubClass(ClassMapping subclassMapping) { --- 985,993 ---- } ! public override String ToString() { return "ClassMapping: " + name.FullyQualifiedName; } public virtual void addSubClass(ClassMapping subclassMapping) { Index: ClassName.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Tool.hbm2net/ClassName.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ClassName.cs 25 Jul 2004 11:41:03 -0000 1.1 --- ClassName.cs 13 Sep 2004 12:47:59 -0000 1.2 *************** *** 1,4 **** using System; ! using StringHelper = NHibernate.Util.StringHelper; namespace NHibernate.Tool.hbm2net --- 1,4 ---- using System; ! using NHibernate.Util; namespace NHibernate.Tool.hbm2net *************** *** 15,19 **** public class ClassName { ! virtual public System.String FullyQualifiedName { get --- 15,19 ---- public class ClassName { ! virtual public String FullyQualifiedName { get *************** *** 27,31 **** /// java.util.Set -> "Set" /// </summary> ! virtual public System.String Name { get --- 27,31 ---- /// java.util.Set -> "Set" /// </summary> ! virtual public String Name { get *************** *** 41,45 **** /// <returns> /// </returns> ! virtual public System.String PackageName { get --- 41,45 ---- /// <returns> /// </returns> ! virtual public String PackageName { get *************** *** 65,69 **** get { ! System.String baseTypeName = StringHelper.Replace(fullyQualifiedName, "[]", ""); return PRIMITIVES.Contains(baseTypeName); } --- 65,69 ---- get { ! String baseTypeName = StringHelper.Replace(fullyQualifiedName, "[]", ""); return PRIMITIVES.Contains(baseTypeName); } *************** *** 73,87 **** internal static readonly SupportClass.SetSupport PRIMITIVES = new SupportClass.HashSetSupport(); ! public ClassName(System.String fqn) { initFullyQualifiedName(fqn); } ! private System.String fullyQualifiedName = null; ! private System.String name = null; ! private System.String packageName = null; /// <summary>Two ClassName are equals if their fullyQualifiedName are the same/equals! </summary> ! public override bool Equals(System.Object other) { ClassName otherClassName = (ClassName) other; --- 73,87 ---- internal static readonly SupportClass.SetSupport PRIMITIVES = new SupportClass.HashSetSupport(); ! public ClassName(String fqn) { initFullyQualifiedName(fqn); } ! private String fullyQualifiedName = null; ! private String name = null; ! private String packageName = null; /// <summary>Two ClassName are equals if their fullyQualifiedName are the same/equals! </summary> ! public override bool Equals(Object other) { ClassName otherClassName = (ClassName) other; *************** *** 96,100 **** public virtual bool inSamePackage(ClassName other) { ! return (System.Object) other.packageName == (System.Object) this.packageName || ((System.Object) other.packageName != null && other.packageName.Equals(this.packageName)); } --- 96,100 ---- public virtual bool inSamePackage(ClassName other) { ! return (Object) other.packageName == (Object) this.packageName || ((Object) other.packageName != null && other.packageName.Equals(this.packageName)); } *************** *** 103,107 **** * Initialize the class fields with info from a fully qualified name. */ ! private void initFullyQualifiedName(System.String fqn) { this.fullyQualifiedName = fqn; --- 103,107 ---- * Initialize the class fields with info from a fully qualified name. */ ! private void initFullyQualifiedName(String fqn) { this.fullyQualifiedName = fqn; *************** *** 110,114 **** if (!Primitive) { ! if ((System.Object) fqn != null) { --- 110,114 ---- if (!Primitive) { ! if ((Object) fqn != null) { *************** *** 139,143 **** } ! public override System.String ToString() { return FullyQualifiedName; --- 139,143 ---- } ! public override String ToString() { return FullyQualifiedName; Index: AssemblyInfo.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Tool.hbm2net/AssemblyInfo.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** AssemblyInfo.cs 2 Sep 2004 16:53:56 -0000 1.2 --- AssemblyInfo.cs 13 Sep 2004 12:47:59 -0000 1.3 *************** *** 1,5 **** using System.Reflection; - using System.Runtime.CompilerServices; - //------------------------------------------------------------------------------ // <autogenerated> --- 1,3 ---- *************** *** 12,23 **** //------------------------------------------------------------------------------ ! [assembly: AssemblyTitleAttribute("NHibernate.Tool.hbm2net for Microsoft .NET Framework 1.1")] ! [assembly: AssemblyDescriptionAttribute("Tool to Generate Classes from hbm.xml files.")] ! [assembly: AssemblyCompanyAttribute("nhibernate.sourceforge.net")] ! [assembly: AssemblyProductAttribute("NHibernate.Tool.hbm2net")] ! [assembly: AssemblyCopyrightAttribute("Licensed under LGPL.")] ! [assembly: AssemblyVersionAttribute("0.2.0.0")] ! [assembly: AssemblyInformationalVersionAttribute("0.2")] ! [assembly: AssemblyFileVersionAttribute("0.2.0.0")] ! [assembly: AssemblyDelaySignAttribute(false)] --- 10,21 ---- //------------------------------------------------------------------------------ ! [assembly: AssemblyTitle("NHibernate.Tool.hbm2net for Microsoft .NET Framework 1.1")] ! [assembly: AssemblyDescription("Tool to Generate Classes from hbm.xml files.")] ! [assembly: AssemblyCompany("nhibernate.sourceforge.net")] ! [assembly: AssemblyProduct("NHibernate.Tool.hbm2net")] ! [assembly: AssemblyCopyright("Licensed under LGPL.")] ! [assembly: AssemblyVersion("0.2.0.0")] ! [assembly: AssemblyInformationalVersion("0.2")] ! [assembly: AssemblyFileVersion("0.2.0.0")] ! [assembly: AssemblyDelaySign(false)] Index: BasicRenderer.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Tool.hbm2net/BasicRenderer.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** BasicRenderer.cs 25 Jul 2004 11:41:03 -0000 1.1 --- BasicRenderer.cs 13 Sep 2004 12:47:59 -0000 1.2 *************** *** 159,170 **** /// <summary> Method doSupportMethods.</summary> ! /// <param name="">fieldTypes ! /// </param> ! /// <param name="">vetoSupport ! /// </param> ! /// <param name="">changeSupport ! /// </param> ! /// <param name="">propWriter ! /// </param> private void doSupportMethods(int fieldTypes, System.String vetoSupport, System.String changeSupport, System.IO.StringWriter writer) { --- 159,166 ---- /// <summary> Method doSupportMethods.</summary> ! /// <param name="changeSupport"></param> ! /// <param name="fieldTypes"></param> ! /// <param name="vetoSupport"></param> ! /// <param name="writer"></param> private void doSupportMethods(int fieldTypes, System.String vetoSupport, System.String changeSupport, System.IO.StringWriter writer) { *************** *** 193,201 **** /// <summary> Method doSupports.</summary> ! /// <param name="">vetoSupport /// </param> ! /// <param name="">changeSupport /// </param> ! /// <param name="">writer /// </param> private void doSupports(int fieldTypes, ClassMapping classMapping, System.String vetoSupport, System.String changeSupport, System.IO.StringWriter writer) --- 189,197 ---- /// <summary> Method doSupports.</summary> ! /// <param name="vetoSupport"> /// </param> ! /// <param name="changeSupport"> /// </param> ! /// <param name="writer"> /// </param> private void doSupports(int fieldTypes, ClassMapping classMapping, System.String vetoSupport, System.String changeSupport, System.IO.StringWriter writer) Index: AbstractRenderer.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Tool.hbm2net/AbstractRenderer.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** AbstractRenderer.cs 25 Jul 2004 11:41:03 -0000 1.1 --- AbstractRenderer.cs 13 Sep 2004 12:47:59 -0000 1.2 *************** *** 6,9 **** --- 6,13 ---- */ using System; + using System.Collections; + using System.Collections.Specialized; + using System.IO; + namespace NHibernate.Tool.hbm2net { *************** *** 14,40 **** { ! public virtual void render(System.String savedToPackage, System.String savedToClass, ClassMapping classMapping, System.Collections.IDictionary class2classmap, System.IO.StreamWriter writer) { } ! internal System.Collections.Specialized.NameValueCollection properties; ! public virtual void configure(System.Collections.Specialized.NameValueCollection props) { this.properties = props; } ! public virtual System.String getFieldScope(FieldProperty field, System.String localScopeName, System.String defaultScope) { return field.getScope(localScopeName, defaultScope); } ! public virtual System.String getPackageDeclaration(System.String savedToPackage, ClassMapping classMapping) { ! if ((System.Object) savedToPackage != null && !savedToPackage.Trim().Equals("")) { return "namespace " + savedToPackage + ""; } ! else if ((System.Object) classMapping.GeneratedPackageName != null) { return "namespace " + classMapping.GeneratedPackageName + ""; --- 18,44 ---- { ! public virtual void render(String savedToPackage, String savedToClass, ClassMapping classMapping, IDictionary class2classmap, StreamWriter writer) { } ! internal NameValueCollection properties; ! public virtual void configure(NameValueCollection props) { this.properties = props; } ! public virtual String getFieldScope(FieldProperty field, String localScopeName, String defaultScope) { return field.getScope(localScopeName, defaultScope); } ! public virtual String getPackageDeclaration(String savedToPackage, ClassMapping classMapping) { ! if ((Object) savedToPackage != null && !savedToPackage.Trim().Equals("")) { return "namespace " + savedToPackage + ""; } ! else if ((Object) classMapping.GeneratedPackageName != null) { return "namespace " + classMapping.GeneratedPackageName + ""; *************** *** 43,49 **** } ! protected internal virtual void genPackageDelaration(System.String savedToPackage, ClassMapping classMapping, System.IO.StreamWriter w) { ! System.String string_Renamed = getPackageDeclaration(savedToPackage, classMapping); if (string_Renamed.Length > 0) { --- 47,53 ---- } ! protected internal virtual void genPackageDelaration(String savedToPackage, ClassMapping classMapping, StreamWriter w) { ! String string_Renamed = getPackageDeclaration(savedToPackage, classMapping); if (string_Renamed.Length > 0) { *************** *** 56,65 **** } ! public virtual System.String getSaveToClassName(ClassMapping classMapping) { return classMapping.GeneratedName; } ! public virtual System.String getSaveToPackage(ClassMapping classMapping) { return classMapping.GeneratedPackageName; --- 60,69 ---- } ! public virtual String getSaveToClassName(ClassMapping classMapping) { return classMapping.GeneratedName; } ! public virtual String getSaveToPackage(ClassMapping classMapping) { return classMapping.GeneratedPackageName; Index: FieldProperty.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Tool.hbm2net/FieldProperty.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** FieldProperty.cs 25 Jul 2004 11:41:03 -0000 1.1 --- FieldProperty.cs 13 Sep 2004 12:47:59 -0000 1.2 *************** *** 1,3 **** --- 1,5 ---- using System; + using System.Reflection; + using log4net; using MultiMap = System.Collections.Hashtable; using Element = System.Xml.XmlElement; *************** *** 9,13 **** public class FieldProperty:MappingElement { ! private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); public string fieldcase --- 11,15 ---- public class FieldProperty:MappingElement { ! private static readonly ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); public string fieldcase *************** *** 27,31 **** } } ! virtual public System.String FieldName { get --- 29,33 ---- } } ! virtual public String FieldName { get *************** *** 35,39 **** } ! virtual public System.String AccessorName { get --- 37,41 ---- } ! virtual public String AccessorName { get *************** *** 43,47 **** } ! private System.String GetterType { get --- 45,49 ---- } ! private String GetterType { get *************** *** 51,55 **** } ! virtual public System.String FullyQualifiedTypeName { get --- 53,57 ---- } ! virtual public String FullyQualifiedTypeName { get *************** *** 106,111 **** /// </returns> /// <summary> Sets the foreignClass.</summary> - /// <param name="foreignClass">The foreignClass to set - /// </param> virtual public ClassName ForeignClass { --- 108,111 ---- *************** *** 135,139 **** /// <returns> String /// </returns> ! virtual public System.String GetterSignature { get --- 135,139 ---- /// <returns> String /// </returns> ! virtual public String GetterSignature { get *************** *** 172,176 **** } ! virtual public System.String FieldScope { get --- 172,176 ---- } ! virtual public String FieldScope { get *************** *** 180,184 **** } ! virtual public System.String PropertyGetScope { get --- 180,184 ---- } ! virtual public String PropertyGetScope { get *************** *** 188,192 **** } ! virtual public System.String PropertySetScope { get --- 188,192 ---- } ! virtual public String PropertySetScope { get *************** *** 198,205 **** /// <summary>the field name </summary> ! private System.String fieldName = null; /// <summary>the property name </summary> ! private System.String accessorName = null; /// <summary>true if this is part of an id </summary> --- 198,205 ---- /// <summary>the field name </summary> ! private String fieldName = null; /// <summary>the property name </summary> ! private String accessorName = null; /// <summary>true if this is part of an id </summary> *************** *** 216,237 **** private ClassMapping parentClass; ! ! ! public FieldProperty(Element element, MappingElement parent, System.String name, ClassName type, bool nullable, MultiMap metaattribs):base(element, parent) { initWith(name, type, type, nullable, id, false, null, null, metaattribs); } ! public FieldProperty(Element element, MappingElement parent, System.String name, ClassName type, bool nullable, bool id, bool generated, MultiMap metaattribs):base(element, parent) { initWith(name, type, type, nullable, id, generated, null, null, metaattribs); } ! public FieldProperty(Element element, MappingElement parent, System.String name, ClassName type, ClassName implementationClassName, bool nullable, ClassName foreignClass, SupportClass.SetSupport foreignKeys, MultiMap metaattribs):base(element, pa... [truncated message content] |