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
|
Update of /cvsroot/nhibernate/NHibernateContrib/src/NHibernate.Tool.hbm2net In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26138/NHibernate.Tool.hbm2net Added Files: .cvsignore AbstractRenderer.cs App.config AssemblyInfo.cs BasicRenderer.cs ClassMapping.cs ClassName.cs CodeGenerator.cs convert.vm DOMRenderer.cs FieldProperty.cs FinderRenderer.cs Generator.cs JavaTool.cs MappingElement.cs MetaAttributeHelper.cs MethodSignatureBuilder.cs NHibernate.Tool.hbm2net-1.1.csproj NHibernate.Tool.hbm2net.build QueryBuilder.cs Renderer.cs StringResourceLoader.cs SupportClass.cs VelocityRenderer.cs Log Message: Moved NHibernate.Tasks and NHibernate.Tool.hbm2net over to the NHibernateContrib module. --- NEW FILE: Renderer.cs --- using System; using System.Collections; using System.Collections.Specialized; using System.IO; namespace NHibernate.Tool.hbm2net { public interface Renderer { /// <summary>Called with the optional list of properties from config.xml </summary> void configure(NameValueCollection properties); /// <summary> </summary> /// <param name="savedToPackage">what package is this class placed in /// </param> /// <param name="savedToClass">what classname does it really get /// </param> /// <param name="classMapping">what classmapping is this for /// </param> /// <param name="class2classmap">A complete map from classname to the classmapping /// </param> /// <param name="writer">where we want the output /// @throws Exception /// </param> void render(String savedToPackage, String savedToClass, ClassMapping classMapping, IDictionary class2classmap, StreamWriter writer); /// <summary> Called by the generator to determine the package name of the rendered class. /// /// </summary> /// <param name="classMapping">The class mapping of the generated class /// </param> /// <returns> the package name the class should be saved to /// </returns> String getSaveToPackage(ClassMapping classMapping); /// <summary> Called by the generator to determine the class name of the rendered class. /// /// </summary> /// <param name="classMapping">The class mapping of the generated class /// </param> /// <returns> the class name the class should be saved to /// </returns> String getSaveToClassName(ClassMapping classMapping); } } --- NEW FILE: MetaAttributeHelper.cs --- using System; using System.Collections; using System.Text; using MultiHashMap = System.Collections.Hashtable; using MultiMap = System.Collections.Hashtable; using Element = System.Xml.XmlElement; namespace NHibernate.Tool.hbm2net { /// <summary> Helper for loading, merging and accessing <meta> tags. /// /// </summary> /// <author> max /// /// /// </author> public class MetaAttributeHelper { internal class MetaAttribute { internal String value_Renamed; internal bool inheritable = true; internal MetaAttribute(String value_Renamed, bool inherit) { this.value_Renamed = value_Renamed; this.inheritable = inherit; } public override String ToString() { return value_Renamed; } } /// <summary> Load meta attributes from jdom element into a MultiMap. /// /// </summary> /// <returns> MultiMap /// </returns> static protected internal MultiMap loadMetaMap(Element element) { MultiMap result = new MultiHashMap(); SupportClass.ListCollectionSupport metaAttributeList = new SupportClass.ListCollectionSupport(); metaAttributeList.AddAll(element.SelectNodes("meta", CodeGenerator.nsmgr)); metaAttributeList.AddAll(element.SelectNodes("urn:meta", CodeGenerator.nsmgr)); for (IEnumerator iter = metaAttributeList.GetEnumerator(); iter.MoveNext(); ) { Element metaAttrib = (Element) iter.Current; // does not use getTextNormalize() or getTextTrim() as that would remove the formatting in new lines in items like description for javadocs. String attribute = (metaAttrib.Attributes["attribute"] == null?string.Empty:metaAttrib.Attributes["attribute"].Value); String value_Renamed = metaAttrib.InnerText; String inheritStr = (metaAttrib.Attributes["inherit"] == null?null:metaAttrib.Attributes["inherit"].Value); bool inherit = true; if ((Object) inheritStr != null) { try { inherit = Boolean.Parse(inheritStr); } catch{} } MetaAttribute ma = new MetaAttribute(value_Renamed, inherit); if (result[attribute] == null) result[attribute] = new SupportClass.ListCollectionSupport(); ((SupportClass.ListCollectionSupport)result[attribute]).Add(ma); } return result; } /// <summary> Merges a Multimap with inherited maps. /// Values specified always overrules/replaces the inherited values. /// /// </summary> /// <returns> a MultiMap with all values from local and extra values /// from inherited /// </returns> static public MultiMap mergeMetaMaps(MultiMap local, MultiMap inherited) { MultiHashMap result = new MultiHashMap(); SupportClass.PutAll(result, local); if (inherited != null) { for (IEnumerator iter = new SupportClass.SetSupport(inherited.Keys).GetEnumerator(); iter.MoveNext(); ) { String key = (String) iter.Current; if (!local.ContainsKey(key)) { // inheriting a meta attribute only if it is inheritable ArrayList ml = (ArrayList) inherited[key]; for (IEnumerator iterator = ml.GetEnumerator(); iterator.MoveNext(); ) { MetaAttribute element = (MetaAttribute) iterator.Current; if (element.inheritable) { if (result[key] == null) result[key] = new SupportClass.ListCollectionSupport(); ((SupportClass.ListCollectionSupport)result[key]).Add(element); } } } } } return result; } /// <summary> Method loadAndMergeMetaMap.</summary> /// <returns> MultiMap /// </returns> public static MultiMap loadAndMergeMetaMap(Element classElement, MultiMap inheritedMeta) { return mergeMetaMaps(loadMetaMap(classElement), inheritedMeta); } public static String getMetaAsString(SupportClass.ListCollectionSupport meta, String seperator) { StringBuilder buf = new StringBuilder(); bool first = true; for (IEnumerator iter = meta.GetEnumerator(); iter.MoveNext(); ) { if (first) first = false; else buf.Append(seperator); buf.Append(iter.Current); } return buf.ToString(); } internal static bool getMetaAsBool(SupportClass.ListCollectionSupport c, bool defaultValue) { if (c == null || c.IsEmpty()) { return defaultValue; } else { try { //return System.Boolean.Parse(c.GetEnumerator().Current.ToString()); return Convert.ToBoolean(c[0].ToString()); } catch{} return defaultValue; } } internal static String getMetaAsString(SupportClass.ListCollectionSupport c) { if (c == null || c.IsEmpty()) { return string.Empty; } else { StringBuilder sb = new StringBuilder(); for (IEnumerator iter = c.GetEnumerator(); iter.MoveNext(); ) { Object element = iter.Current; sb.Append(element.ToString()); } return sb.ToString(); } } } } --- NEW FILE: FinderRenderer.cs --- using System; using System.Collections; using System.IO; using System.Reflection; using log4net; namespace NHibernate.Tool.hbm2net { /// <summary> <p>Title: Basic Finder Generator for Hibernate 2</p> /// <p>Description: Generate basic finders for hibernate properties. /// This requires two things in the hbm.xml files. /// /// The first is an indication of which fields you want to generate finders for. /// You indicate that with a meta block inside a property tag such as /// /// <property name="name" column="name" type="string"> /// <meta attribute="finder-method">findByName</meta> /// </property> /// /// The finder method name will be the text enclosed in the meta tags. /// /// If you want to generate a finder based on a join you can do something like this: /// /// <set name="games" inverse="true" lazy="true" table="GamePlayers"> /// <meta attribute="foreign-finder-name">findSavedGames</meta> /// <meta attribute="foreign-finder-field">save</meta> /// <meta attribute="foreign-join-field">players</meta> /// <key column="playerID"/> /// <many-to-many class="com.whatever.Game" column="gameID"/> /// </set> /// /// Where foreign-finder-name will be the name of the finder when generated, foreign-finder-field is the field in /// the foreign class that you will want as a paramter to the finder (the criteria in the query) and foreign-join-field /// is the field in teh foreign class that joins to this object (in case there are more than one collection of these /// objects in the foreign class). /// /// After you've defined your finders, the second thing to do is to create a config file for hbm2net of the format: /// /// <codegen> /// <generate renderer="NHibernate.Tool.hbm2net.BasicRenderer"/> /// <generate suffix="Finder" renderer="NHibernate.Tool.hbm2net.FinderRenderer"/> /// </codegen> /// /// And then use the param to hbm2net --config=xxx.xml where xxx.xml is the config file you /// just created. /// /// An optional parameter is meta tag at the class level of the format: /// /// <meta attribute="session-method">com.whatever.SessionTable.getSessionTable().getSession();</meta> /// /// Which would be the way in which you get sessions if you use the Thread Local Session pattern /// like I do. /// </p> /// <p>Copyright: Copyright (c) 2003</p> /// </summary> /// <author> Matt Hall (matt2k(at)users.sf.net) /// </author> /// <author> Max Rydahl Andersen (small adjustments and bugfixes) /// </author> /// <version> 1.0 /// </version> public class FinderRenderer:AbstractRenderer { private static readonly ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); public FinderRenderer() { InitBlock(); } private void InitBlock() { object tempObject; tempObject = "Character"; primitiveToObject["char"] = tempObject; object tempObject2; tempObject2 = "Byte"; primitiveToObject["byte"] = tempObject2; object tempObject3; tempObject3 = "Short"; primitiveToObject["short"] = tempObject3; object tempObject4; tempObject4 = "Integer"; primitiveToObject["int"] = tempObject4; object tempObject5; tempObject5 = "Long"; primitiveToObject["long"] = tempObject5; object tempObject6; tempObject6 = "Boolean"; primitiveToObject["boolean"] = tempObject6; object tempObject7; tempObject7 = "Float"; primitiveToObject["float"] = tempObject7; object tempObject8; tempObject8 = "Double"; primitiveToObject["double"] = tempObject8; hibType["char"] = "Hibernate.CHARACTER"; hibType["byte"] = "Hibernate.BYTE"; tempObject3 = "Hibernate.SHORT"; hibType["short"] = "Hibernate.SHORT"; tempObject4 = "Hibernate.INTEGER"; hibType["int"] = tempObject4; tempObject5 = "Hibernate.LONG"; hibType["long"] = tempObject5; tempObject6 = "Hibernate.INTEGER"; hibType["Integer"] = tempObject6; tempObject7 = "Hibernate.BOOLEAN"; hibType["boolean"] = tempObject7; tempObject8 = "Hibernate.FLOAT"; hibType["float"] = tempObject8; object tempObject9; tempObject9 = "Hibernate.DOUBLE"; hibType["double"] = tempObject9; object tempObject10; tempObject10 = "Hibernate.STRING"; hibType["String"] = tempObject10; object tempObject11; tempObject11 = "Hibernate.LOCALE"; hibType["Locale"] = tempObject11; } private const String MT_FINDERMETHOD = "finder-method"; private const String MT_FOREIGNFINDERMETHOD = "foreign-finder-name"; private const String MT_FOREIGNFINDERFIELD = "foreign-finder-field"; private const String MT_FOREIGNJOINFIELD = "foreign-join-field"; /// <summary> Render finder classes.</summary> /// <exception cref=""> Exception /// </exception> public override void render(String savedToPackage, String savedToClass, ClassMapping classMapping, IDictionary class2classmap, StreamWriter mainwriter) { genPackageDelaration(savedToPackage, classMapping, mainwriter); mainwriter.WriteLine(); // switch to another writer to be able to insert the actually // used imports when whole class has been rendered. StringWriter writer = new StringWriter(); writer.WriteLine("/** Automatically generated Finder class for " + savedToClass + ".\n" + " * @author Hibernate FinderGenerator " + " **/"); String classScope = "public"; writer.Write(classScope + " class " + savedToClass); // always implements Serializable writer.Write(" implements Serializable"); writer.WriteLine(" {"); writer.WriteLine(); // switch to another writer to be able to insert the // veto- and changeSupport fields StringWriter propWriter = new StringWriter(); doFinders(classMapping, class2classmap, propWriter); propWriter.WriteLine("}"); writer.Write(propWriter.ToString()); // finally write the imports doImports(classMapping, mainwriter); mainwriter.Write(writer.ToString()); } /// <summary> Create finders for properties that have the <meta atttribute="finder-method"> /// finderName</meta> block defined. Also, create a findAll(Session) method. /// /// </summary> public virtual void doFinders(ClassMapping classMapping, IDictionary class2classmap, StringWriter writer) { // Find out of there is a system wide way to get sessions defined String sessionMethod = classMapping.getMetaAsString("session-method").Trim(); // fields //UPGRADE_TODO: Method 'java.util.Iterator.hasNext' was converted to 'System.Collections.IEnumerator.MoveNext' which has a different behavior. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1073_javautilIteratorhasNext"' for (IEnumerator fields = classMapping.Fields.GetEnumerator(); fields.MoveNext(); ) { //UPGRADE_TODO: Method 'java.util.Iterator.next' was converted to 'System.Collections.IEnumerator.Current' which has a different behavior. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1073_javautilIteratornext"' FieldProperty field = (FieldProperty) fields.Current; if (field.getMeta(MT_FINDERMETHOD) != null) { String finderName = field.getMetaAsString(MT_FINDERMETHOD); if ("".Equals(sessionMethod)) { // Make the method signature require a session to be passed in writer.WriteLine(" public static List " + finderName + "(Session session, " + JavaTool.getTrueTypeName(field, class2classmap) + " " + field.FieldName + ") " + "throws SQLException, HibernateException {"); } else { // Use the session method to get the session to execute the query writer.WriteLine(" public static List " + finderName + "(" + JavaTool.getTrueTypeName(field, class2classmap) + " " + field.FieldName + ") " + "throws SQLException, HibernateException {"); writer.WriteLine(" Session session = " + sessionMethod); } writer.WriteLine(" List finds = session.find(\"from " + classMapping.FullyQualifiedName + " as " + classMapping.Name.ToLower() + " where " + classMapping.Name.ToLower() + "." + field.FieldName + "=?\", " + getFieldAsObject(false, field) + ", " + getFieldAsHibernateType(false, field) + ");"); writer.WriteLine(" return finds;"); writer.WriteLine(" }"); writer.WriteLine(); } else if (field.getMeta(MT_FOREIGNFINDERMETHOD) != null) { String finderName = field.getMetaAsString(MT_FOREIGNFINDERMETHOD); String fieldName = field.getMetaAsString(MT_FOREIGNFINDERFIELD); String joinFieldName = field.getMetaAsString(MT_FOREIGNJOINFIELD); // Build the query QueryBuilder qb = new QueryBuilder(); qb.LocalClass = classMapping; qb.setForeignClass(field.ForeignClass, class2classmap, joinFieldName); //UPGRADE_TODO: Method 'java.util.Map.get' was converted to 'System.Collections.IDictionary.Item' which has a different behavior. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1073_javautilMapget_javalangObject"' ClassMapping foreignClass = (ClassMapping) class2classmap[field.ForeignClass.FullyQualifiedName]; if (foreignClass == null) { // Can't find the class, return log.Error("Could not find the class " + field.ForeignClass.Name); return ; } FieldProperty foreignField = null; //UPGRADE_TODO: Method 'java.util.Iterator.hasNext' was converted to 'System.Collections.IEnumerator.MoveNext' which has a different behavior. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1073_javautilIteratorhasNext"' for (IEnumerator foreignFields = foreignClass.Fields.GetEnumerator(); foreignFields.MoveNext(); ) { //UPGRADE_TODO: Method 'java.util.Iterator.next' was converted to 'System.Collections.IEnumerator.Current' which has a different behavior. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1073_javautilIteratornext"' FieldProperty f = (FieldProperty) foreignFields.Current; if (f.FieldName.Equals(fieldName)) { foreignField = f; } } if (foreignField != null) { qb.addCritera(foreignClass, foreignField, "="); } else { // Can't find the field, return log.Error("Could not find the field " + fieldName + " that was supposed to be in class " + field.ForeignClass.Name); return ; } MethodSignatureBuilder msb = new MethodSignatureBuilder(finderName, "List", "public static"); if ("".Equals(sessionMethod)) { // Make the method signature require a session to be passed in msb.addParam("Session session"); /* writer.println(" public static List " + finderName + "(Session session, " + getTrueTypeName(foreignField, class2classmap) + " " + foreignField.getName() + ") " + "throws SQLException, HibernateException {");*/ } else { // Use the session method to get the session to execute the query /* writer.println(" public static List " + finderName + "(" + getTrueTypeName(foreignField, class2classmap) + " " + foreignField.getName() + ") " + "throws SQLException, HibernateException {"); writer.println(" Session session = " + sessionMethod);*/ } // Always need the object we're basing the query on msb.addParam(classMapping.Name + " " + classMapping.Name.ToLower()); // And the foreign class field msb.addParam(JavaTool.getTrueTypeName(foreignField, class2classmap) + " " + foreignField.FieldName); msb.addThrows("SQLException"); msb.addThrows("HibernateException"); writer.WriteLine(" " + msb.buildMethodSignature()); if (!"".Equals(sessionMethod)) { writer.WriteLine(" Session session = " + sessionMethod); } writer.WriteLine(" List finds = session.find(\"" + qb.Query + "\", " + qb.ParamsAsString + ", " + qb.ParamTypesAsString + ");"); writer.WriteLine(" return finds;"); writer.WriteLine(" }"); writer.WriteLine(); } } // Create the findAll() method if ("".Equals(sessionMethod)) { writer.WriteLine(" public static List findAll" + "(Session session) " + "throws SQLException, HibernateException {"); } else { writer.WriteLine(" public static List findAll() " + "throws SQLException, HibernateException {"); writer.WriteLine(" Session session = " + sessionMethod); } writer.WriteLine(" List finds = session.find(\"from " + classMapping.Name + " in class " + classMapping.PackageName + "." + classMapping.Name + "\");"); writer.WriteLine(" return finds;"); writer.WriteLine(" }"); writer.WriteLine(); } //UPGRADE_TODO: Class 'java.util.HashMap' was converted to 'System.Collections.Hashtable' which has a different behavior. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1073_javautilHashMap"' //UPGRADE_NOTE: The initialization of 'primitiveToObject' was moved to static method 'NHibernate.Tool.hbm2net.FinderRenderer'. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1005"' internal static IDictionary primitiveToObject; /// <summary> Generate the imports for the finder class. /// /// </summary> public virtual void doImports(ClassMapping classMapping, StreamWriter writer) { // imports is not included from the class it self as this is a separate generated class. /* classMapping.getImports().add("java.io.Serializable"); for (Iterator imports = classMapping.getImports().iterator(); imports.hasNext(); ) { writer.println("import " + imports.next() + ";"); }*/ // Imports for finders writer.WriteLine("import java.io.Serializable;"); writer.WriteLine("import java.util.List;"); writer.WriteLine("import java.sql.SQLException;"); writer.WriteLine(); // * import is bad style. But better than importing classing that we don't necesarrily uses... writer.WriteLine("import NHibernate.*;"); writer.WriteLine("import NHibernate.type.Type;"); // writer.println("import NHibernate.Hibernate;"); // writer.println("import NHibernate.HibernateException;"); writer.WriteLine(); } /// <summary> Gets the fieldAsObject attribute of the FinderRenderer object /// /// </summary> /// <returns> /// </returns> public static String getFieldAsObject(bool prependThis, FieldProperty field) { ClassName type = field.ClassType; if (type != null && type.Primitive && !type.Array) { //UPGRADE_TODO: Method 'java.util.Map.get' was converted to 'System.Collections.IDictionary.Item' which has a different behavior. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1073_javautilMapget_javalangObject"' String typeName = (String) primitiveToObject[type.Name]; typeName = "new " + typeName + "( "; typeName += (prependThis?"this.":""); return typeName + field.FieldName + " )"; } return field.FieldName; } /// <summary> Coversion map for field types to Hibernate types, might be good to move /// this to some other more general class /// </summary> //UPGRADE_TODO: Class 'java.util.HashMap' was converted to 'System.Collections.Hashtable' which has a different behavior. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1073_javautilHashMap"' //UPGRADE_NOTE: The initialization of 'hibType' was moved to static method 'NHibernate.Tool.hbm2net.FinderRenderer'. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1005"' internal static IDictionary hibType; /// <summary> Return the hibernate type string for the given field /// /// </summary> /// <returns> /// </returns> public static String getFieldAsHibernateType(bool prependThis, FieldProperty field) { ClassName type = field.ClassType; //UPGRADE_TODO: Method 'java.util.Map.get' was converted to 'System.Collections.IDictionary.Item' which has a different behavior. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1073_javautilMapget_javalangObject"' String hibTypeString = (String) hibType[type.Name]; if ((Object) hibTypeString != null) { return hibTypeString; } else { return "Hibernate.OBJECT"; } } static FinderRenderer() { primitiveToObject = new Hashtable(); hibType = new Hashtable(); } } } --- NEW FILE: CodeGenerator.cs --- 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; using Document = System.Xml.XmlDocument; using Element = System.Xml.XmlElement; namespace NHibernate.Tool.hbm2net { /// <summary> </summary> 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(); MultiMap globalMetas = new MultiHashMap(); // parse command line parameters for (int i = 0; i < args.Length; i++) { if (args[i].StartsWith("--")) { if (args[i].StartsWith("--config=")) { // 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()) { generators.Add(new Generator((Element) generateElements.Current)); } } else if (args[i].StartsWith("--output=")) { outputDir = args[i].Substring(9); } } else { mappingFiles.Add(args[i]); } } // if no config xml file, add a default generator if (generators.Count == 0) { generators.Add(new Generator()); } Hashtable classMappings = new Hashtable(); for (IEnumerator iter = mappingFiles.GetEnumerator(); iter.MoveNext(); ) { try { 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"]; if (rootElement == null) continue; XmlAttribute a = rootElement.Attributes["package"]; String pkg = null; if (a != null) { pkg = a.Value; } 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); classElements = rootElement.SelectNodes("urn:subclass", nsmgr).GetEnumerator(); handleClass(pkg, me, classMappings, classElements, mm, true); classElements = rootElement.SelectNodes("urn:joined-subclass", nsmgr).GetEnumerator(); handleClass(pkg, me, classMappings, classElements, mm, true); } catch(Exception exc) { log.Error("Error in map",exc); } } // generate source files for (IEnumerator iterator = generators.GetEnumerator(); iterator.MoveNext(); ) { Generator g = (Generator) iterator.Current; g.BaseDirName = outputDir; g.generate(classMappings); } } catch (Exception e) { SupportClass.WriteStackTrace(e, Console.Error); } } private static void handleClass(String classPackage, MappingElement me, Hashtable classMappings, IEnumerator classElements, MultiMap mm, bool extendz) { while (classElements.MoveNext()) { Element clazz = (Element) classElements.Current; if (!extendz) { ClassMapping cmap = new ClassMapping(classPackage, clazz, me, mm); SupportClass.PutElement(classMappings, cmap.FullyQualifiedName, cmap); } 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 + ">"); } ClassMapping superclass = (ClassMapping) classMappings[ex]; if (superclass == null) { throw new MappingException("Cannot extend unmapped class " + ex); } ClassMapping subclassMapping = new ClassMapping(classPackage, me, superclass.ClassName, superclass, clazz, mm); superclass.addSubClass(subclassMapping); } } } } } --- NEW FILE: Generator.cs --- using System; using System.Collections; using System.Collections.Specialized; using System.IO; using System.Reflection; using log4net; using NHibernate.Util; using Element = System.Xml.XmlElement; namespace NHibernate.Tool.hbm2net { /// <summary> </summary> public class Generator { private static readonly ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private void InitBlock() { suffix = string.Empty; prefix = string.Empty; } virtual public String BaseDirName { get { return baseDirName; } set { if ((Object) value != null) { this.baseDirName = value; } } } private String rendererClass = "NHibernate.Tool.hbm2net.VelocityRenderer"; private String baseDirName = "generated"; private String packageName = null; private String suffix; private String prefix; private String extension = "cs"; private bool lowerFirstLetter = false; public static NameValueCollection params_Renamed = new NameValueCollection(); /// <summary> Constructs a new Generator using the defaults.</summary> public Generator() { InitBlock(); } /// <summary> Constructs a new Generator, configured from XML.</summary> public Generator(Element generateElement) { InitBlock(); String value_Renamed = null; // set rendererClass field if ((Object) (this.rendererClass = (generateElement.Attributes["renderer"] == null?null:generateElement.Attributes["renderer"].Value)) == null) { throw new Exception("attribute renderer is required."); } // set dirName field if ((Object) (value_Renamed = (generateElement.Attributes["dir"] == null?null:generateElement.Attributes["dir"].Value)) != null) { this.baseDirName = value_Renamed; } // set packageName field this.packageName = (generateElement.Attributes["package"] == null?null:generateElement.Attributes["package"].Value); // set prefix if ((Object) (value_Renamed = (generateElement.Attributes["prefix"] == null?null:generateElement.Attributes["prefix"].Value)) != null) { this.prefix = value_Renamed; } // set suffix if ((Object) (value_Renamed = (generateElement.Attributes["suffix"] == null?null:generateElement.Attributes["suffix"].Value)) != null) { this.suffix = value_Renamed; } // set extension if ((Object) (value_Renamed = (generateElement.Attributes["extension"] == null?null:generateElement.Attributes["extension"].Value)) != null) { this.extension = value_Renamed; } // set lowerFirstLetter value_Renamed = (generateElement.Attributes["lowerFirstLetter"] == null?null:generateElement.Attributes["lowerFirstLetter"].Value); try { this.lowerFirstLetter = Boolean.Parse(value_Renamed); } catch{} IEnumerator iter = generateElement.SelectNodes("param").GetEnumerator(); while (iter.MoveNext()) { Element childNode = (Element) iter.Current; params_Renamed[childNode.Attributes["name"].Value] = childNode.InnerText; } } /// <summary> </summary> public virtual void generate(IDictionary classMappingsCol) { log.Info("Generating " + classMappingsCol.Count + " in " + BaseDirName); Renderer renderer = (Renderer) SupportClass.CreateNewInstance(System.Type.GetType(this.rendererClass)); /// <summary>Configure renderer </summary> renderer.configure(params_Renamed); /// <summary>Running through actual classes </summary> for (IEnumerator classMappings = classMappingsCol.Values.GetEnumerator(); classMappings.MoveNext(); ) { ClassMapping classMapping = (ClassMapping) classMappings.Current; writeRecur(classMapping, classMappingsCol, renderer); } /// <summary>Running through components </summary> for (IEnumerator cmpMappings = ClassMapping.Components; cmpMappings.MoveNext(); ) { ClassMapping mapping = (ClassMapping) cmpMappings.Current; write(mapping, classMappingsCol, renderer); } } private void writeRecur(ClassMapping classMapping, IDictionary class2classmap, Renderer renderer) { write(classMapping, class2classmap, renderer); if (!(classMapping.Subclasses.Count == 0)) { IEnumerator it = classMapping.Subclasses.GetEnumerator(); while (it.MoveNext()) { writeRecur((ClassMapping) it.Current, class2classmap, renderer); } } } /// <summary> </summary> private void write(ClassMapping classMapping, IDictionary class2classmap, Renderer renderer) { String saveToPackage = renderer.getSaveToPackage(classMapping); String saveToClassName = renderer.getSaveToClassName(classMapping); FileInfo dir = this.getDir(saveToPackage); FileInfo file = new FileInfo(dir.FullName + "\\" + this.getFileName(saveToClassName)); log.Debug("Writing " + file); StreamWriter writer = new StreamWriter(new FileStream(file.FullName, FileMode.Create)); renderer.render(getPackageName(saveToPackage), getName(saveToClassName), classMapping, class2classmap, writer); writer.Close(); } /// <summary> </summary> private String getFileName(String className) { return this.getName(className) + "." + this.extension; } /// <summary> </summary> private String getName(String className) { String name = null; if (this.lowerFirstLetter) { name = className.Substring(0, (1) - (0)).ToLower() + className.Substring(1, (className.Length) - (1)); } else { name = className; } return this.prefix + name + this.suffix; } private String getPackageName(String packageName) { if ((Object) this.packageName == null) { return (Object) packageName == null?string.Empty:packageName; } else { return this.packageName; } } /// <summary> </summary> private FileInfo getDir(String packageName) { FileInfo baseDir = new FileInfo(this.baseDirName); FileInfo dir = null; String p = getPackageName(packageName); dir = new FileInfo(baseDir.FullName + "\\" + p.Replace(StringHelper.Dot, Path.DirectorySeparatorChar)); // if the directory exists, make sure it is a directory bool tmpBool; if (File.Exists(dir.FullName)) tmpBool = true; else tmpBool = Directory.Exists(dir.FullName); if (tmpBool) { if (!Directory.Exists(dir.FullName)) { throw new Exception("The path: " + dir.FullName + " exists, but is not a directory"); } } // else make the directory and any non-existent parent directories else { if (!Directory.CreateDirectory(dir.FullName).Exists) { throw new Exception("unable to create directory: " + dir.FullName); } } return dir; } } } --- NEW FILE: BasicRenderer.cs --- using System; using StringHelper = NHibernate.Util.StringHelper; namespace NHibernate.Tool.hbm2net { public class BasicRenderer:AbstractRenderer { private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); public BasicRenderer() { InitBlock(); } private void InitBlock() { javaTool = new JavaTool(); primitiveToObject["char"] = "Character"; primitiveToObject["byte"] = "Byte"; primitiveToObject["short"] = "Short"; primitiveToObject["int"] = "Integer"; primitiveToObject["long"] = "Long"; primitiveToObject["boolean"] = "Boolean"; primitiveToObject["float"] = "Float"; primitiveToObject["double"] = "Double"; } protected internal const int ORDINARY = 0; protected internal const int BOUND = 1; protected internal const int CONSTRAINT = 3; //any constraint properties are bound as well internal JavaTool javaTool; public override void render(System.String savedToPackage, System.String savedToClass, ClassMapping classMapping, System.Collections.IDictionary class2classmap, System.IO.StreamWriter mainwriter) { mainwriter.WriteLine("using System;"); mainwriter.WriteLine(@"//------------------------------------------------------------------------------ // <autogenerated> // This code was generated by a tool. // Runtime Version: {0} // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </autogenerated> //------------------------------------------------------------------------------ ",Guid.Empty.GetType().Assembly.ImageRuntimeVersion); genPackageDelaration(savedToPackage, classMapping, mainwriter); mainwriter.WriteLine("{"); // switch to another writer to be able to insert the actually // used imports when whole class has been rendered. System.IO.StringWriter writer = new System.IO.StringWriter(); // class declaration if (classMapping.getMeta("class-description") == null) { writer.WriteLine(@" /// <summary> /// POJO for {0} /// </summary> /// <remark> /// This class is autogenerated /// </remark> ", classMapping.ClassName); } else { writer.WriteLine("/// <summary>\n" + javaTool.toJavaDoc(classMapping.getMetaAsString("class-description"), 0) + "\n/// </summary>"); } System.String classScope = classMapping.Scope; System.String declarationType = classMapping.DeclarationType; //classMapping.addImport(typeof(System.Runtime.Serialization.ISerializable)); //String modifiers = classMapping.getModifiers(); if (classMapping.shouldBeAbstract() && (classScope.IndexOf("abstract") == - 1)) { writer.Write("abstract " + classScope + " " + declarationType + " " + savedToClass); } else { writer.Write(classScope + " " + declarationType + " " + savedToClass); } if (javaTool.hasExtends(classMapping) || javaTool.hasImplements(classMapping)) { writer.Write(" : "); } if (javaTool.hasExtends(classMapping)) { writer.Write(javaTool.getExtends(classMapping)); } if (javaTool.hasExtends(classMapping) && javaTool.hasImplements(classMapping)) { writer.Write(", "); } if (javaTool.hasImplements(classMapping)) { writer.Write(javaTool.getImplements(classMapping)); } writer.WriteLine(" {"); writer.WriteLine(); // switch to another writer to be able to insert the // veto- and changeSupport fields System.IO.StringWriter propWriter = new System.IO.StringWriter(); if (!classMapping.Interface) { doFields(classMapping, class2classmap, propWriter); doConstructors(savedToClass, classMapping, class2classmap, propWriter); } System.String vetoSupport = makeSupportField("vetos", classMapping.AllFields); System.String changeSupport = makeSupportField("changes", classMapping.AllFields); int fieldTypes = doFieldAccessors(classMapping, class2classmap, propWriter, vetoSupport, changeSupport); if (!classMapping.Interface) { doSupportMethods(fieldTypes, vetoSupport, changeSupport, propWriter); doToString(classMapping, propWriter); doEqualsAndHashCode(savedToClass, classMapping, propWriter); } if (classMapping.getMeta("class-code") != null) { propWriter.WriteLine("// The following is extra code specified in the hbm.xml files"); SupportClass.ListCollectionSupport extras = classMapping.getMeta("class-code"); System.Collections.IEnumerator iter = extras.GetEnumerator(); while (iter.MoveNext()) { System.String code = iter.Current.ToString(); propWriter.WriteLine(code); } propWriter.WriteLine("// end of extra code specified in the hbm.xml files"); } propWriter.WriteLine("}"); //insert change and VetoSupport if (!classMapping.Interface) { doSupports(fieldTypes, classMapping, vetoSupport, changeSupport, writer); } writer.Write(propWriter.ToString()); // finally write the imports doImports(classMapping, mainwriter); mainwriter.Write(writer.ToString()); mainwriter.WriteLine("\n}"); } /// <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) { if ((fieldTypes & CONSTRAINT) == CONSTRAINT) { writer.WriteLine(" public void addVetoableChangeListener( VetoableChangeListener l ) {"); writer.WriteLine(" " + vetoSupport + ".addVetoableChangeListener(l);"); writer.WriteLine(" }"); writer.WriteLine(" public void removeVetoableChangeListener( VetoableChangeListener l ) {"); writer.WriteLine(" " + vetoSupport + ".removeVetoableChangeListener(l);"); writer.WriteLine(" }"); writer.WriteLine(); } if ((fieldTypes & BOUND) == BOUND) { writer.WriteLine(" public void addPropertyChangeListener( PropertyChangeListener l ) {"); writer.WriteLine(" " + changeSupport + ".addPropertyChangeListener(l);"); writer.WriteLine(" }"); writer.WriteLine(" public void removePropertyChangeListener( PropertyChangeListener l ) {"); writer.WriteLine(" " + changeSupport + ".removePropertyChangeListener(l);"); writer.WriteLine(" }"); writer.WriteLine(); } } /// <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) { if ((fieldTypes & CONSTRAINT) == CONSTRAINT) { writer.WriteLine(" private VetoableChangeSupport " + vetoSupport + " = new VetoableChangeSupport(this);"); writer.WriteLine(); } if ((fieldTypes & BOUND) == BOUND) { writer.WriteLine(" private PropertyChangeSupport " + changeSupport + " = new PropertyChangeSupport(this);"); writer.WriteLine(); } } public virtual void doConstructors(System.String savedToClass, ClassMapping classMapping, System.Collections.IDictionary class2classmap, System.IO.StringWriter writer) { // full constructor SupportClass.ListCollectionSupport allFieldsForFullConstructor = classMapping.AllFieldsForFullConstructor; writer.WriteLine(" /// <summary>\n /// full constructor\n /// </summary>"); System.String fullCons = " public " + savedToClass + StringHelper.OpenParen; fullCons += javaTool.fieldsAsParameters(allFieldsForFullConstructor, classMapping, class2classmap); writer.Write(fullCons + ")"); //invoke super to initialize superclass... SupportClass.ListCollectionSupport supersConstructorFields = classMapping.FieldsForSupersFullConstructor; if (!(supersConstructorFields.Count == 0)) { writer.Write(" : base("); bool first = true; for (System.Collections.IEnumerator fields = supersConstructorFields.GetEnumerator(); fields.MoveNext(); ) { if (first) first = false; else writer.Write(", "); FieldProperty field = (FieldProperty) fields.Current; writer.Write(field.FieldName); } writer.Write(")"); } writer.WriteLine(); writer.WriteLine(" {"); // initialisation of localfields for (System.Collections.IEnumerator fields = classMapping.LocalFieldsForFullConstructor.GetEnumerator(); fields.MoveNext(); ) { FieldProperty field = (FieldProperty) fields.Current; if (field.GeneratedAsProperty) { writer.WriteLine(" this." + field.FieldName + " = " + field.FieldName + ";"); } } writer.WriteLine(" }"); writer.WriteLine(); // no args constructor (if fullconstructor had any arguments!) if (allFieldsForFullConstructor.Count > 0) { writer.WriteLine(" /// <summary>\n /// default constructor\n /// </summary>"); writer.WriteLine(" public " + savedToClass + "() {"); writer.WriteLine(" }"); writer.WriteLine(); } // minimal constructor (only if the fullconstructor had any arguments) if ((allFieldsForFullConstructor.Count > 0) && classMapping.needsMinimalConstructor()) { SupportClass.ListCollectionSupport allFieldsForMinimalConstructor = classMapping.AllFieldsForMinimalConstructor; writer.WriteLine(" /// <summary>\n /// minimal constructor\n /// </summary>"); System.String minCons = " public " + savedToClass + "("; bool first = true; for (System.Collections.IEnumerator fields = allFieldsForMinimalConstructor.GetEnumerator(); fields.MoveNext(); ) { if (first) first = false; else minCons = minCons + ", "; FieldProperty field = (FieldProperty) fields.Current; minCons = minCons + JavaTool.shortenType(JavaTool.getTrueTypeName(field, class2classmap), classMapping.Imports) + " " + field.FieldName; } writer.Write(minCons + ")"); // invoke super to initialize superclass... SupportClass.ListCollectionSupport supersMinConstructorFields = classMapping.FieldsForSupersMinimalConstructor; if (!(supersMinConstructorFields.Count == 0)) { writer.Write(" : base("); bool first2 = true; for (System.Collections.IEnumerator fields = supersMinConstructorFields.GetEnumerator(); fields.MoveNext(); ) { if (first2) first2 = false; else writer.Write(StringHelper.CommaSpace); FieldProperty field = (FieldProperty) fields.Current; writer.Write(field.FieldName); } writer.Write(")"); } writer.WriteLine(); writer.WriteLine(" {"); // initialisation of localfields for (System.Collections.IEnumerator fields = classMapping.LocalFieldsForMinimalConstructor.GetEnumerator(); fields.MoveNext(); ) { FieldProperty field = (FieldProperty) fields.Current; if (field.GeneratedAsProperty) { writer.WriteLine(" this." + field.FieldName + " = " + field.FieldName + ";"); } } writer.WriteLine(" }"); writer.WriteLine(); } } public virtual void doFields(ClassMapping classMapping, System.Collections.IDictionary class2classmap, System.IO.StringWriter writer) { // fields if (!classMapping.Interface) { if (classMapping.SuperInterface) { doFields(classMapping.AllFields, classMapping.Imports, class2classmap, writer); } } SupportClass.ListCollectionSupport fieldList = classMapping.Fields; SupportClass.SetSupport imports = classMapping.Imports; doFields(fieldList, imports, class2classmap, writer); } private void doFields(SupportClass.ListCollectionSupport fieldList, SupportClass.SetSupport imports, System.Collections.IDictionary class2classmap, System.IO.StringWriter writer) { for (System.Collections.IEnumerator fields = fieldList.GetEnumerator(); fields.MoveNext(); ) { FieldProperty field = (FieldProperty) fields.Current; if (field.GeneratedAsProperty) { System.String fieldScope = getFieldScope(field, "scope-field", "private"); writer.WriteLine(" /// <summary>\n /// Holder for " + (field.Nullable && !field.Identifier?"nullable ":string.Empty) + (field.Identifier?"identifier":"persistent") + " field " + field.FieldName + "\n /// </summary>"); writer.Write(" " + fieldScope + " " + field.FullyQualifiedTypeName + " " + field.fieldcase); if (field.getMeta("default-value") != null) { writer.Write(" = " + field.getMetaAsString("default-value")); } writer.WriteLine(';'); } writer.WriteLine(); } } public virtual void doEqualsAndHashCode(System.String savedToClass, ClassMapping classMapping, System.IO.StringWriter writer) { if (classMapping.mustImplementEquals()) { writer.WriteLine(" public override bool Equals(object obj) {"); writer.WriteLine(" if(this == obj) return true;"); writer.WriteLine(" if((obj == null) || (obj.GetType() != this.GetType())) return false;"); writer.WriteLine(" " + savedToClass + " castObj = (" + savedToClass + ") obj;"); writer.Write(" return (castObj != null) "); int usedFields = 0; SupportClass.ListCollectionSupport idFields = new SupportClass.ListCollectionSupport(); for (System.Collections.IEnumerator fields = classMapping.Fields.GetEnumerator(); fields.MoveNext(); ) { FieldProperty field = (FieldProperty) fields.Current; if (field.getMetaAsBool("use-in-equals")) { writer.Write(" && (this." + field.fieldcase + " == castObj." + field.fieldcase + ")"); usedFields++; } if (field.Identifier) { idFields.Add(field); } } if (usedFields == 0) { log.Warn("No properties has been marked as being used in equals/hashcode for " + classMapping.Name + ". Using object identifier which is RARELY safe to use! See http://hibernate.org/109.html"); for (System.Collections.IEnumerator fields = idFields.GetEnumerator(); fields.MoveNext(); ) { FieldProperty field = (FieldProperty) fields.Current; writer.Write(" && (this." + field.fieldcase + " == castObj." + field.fieldcase + ")"); } } writer.WriteLine(";"); writer.WriteLine(" }"); writer.WriteLine(); writer.WriteLine(" public override int GetHashCode() {"); writer.WriteLine(" int hash = 69;"); //writer.Write(" return"); for (System.Collections.IEnumerator fields = classMapping.Fields.GetEnumerator(); fields.MoveNext(); ) { FieldProperty field = (FieldProperty) fields.Current; if (field.getMetaAsBool("use-in-equals")) { //writer.Write("\n " + field.FieldName + ".GetHashCode() ^"); writer.WriteLine(" hash = 31 * hash + " + field.fieldcase + ".GetHashCode();"); } } if (usedFields == 0) { for (System.Collections.IEnumerator fields = idFields.GetEnumerator(); fields.MoveNext(); ) { FieldProperty field = (FieldProperty) fields.Current; //writer.Write("\n " + field.FieldName + ".GetHashCode() ^"); writer.WriteLine(" hash = 31 * hash + " + field.fieldcase + ".GetHashCode();"); } } //writer.WriteLine(" 0;"); writer.WriteLine(" return hash;"); writer.WriteLine(" }"); writer.WriteLine(); } } public virtual void doToString(ClassMapping classMapping, System.IO.StringWriter writer) { writer.WriteLine(" public override string ToString()"); writer.WriteLine(" {"); writer.WriteLine(" System.Text.StringBuilder sb = new System.Text.StringBuilder();"); for (System.Collections.IEnumerator fields = classMapping.AllFields.GetEnumerator(); fields.MoveNext(); ) { FieldProperty field = (FieldProperty) fields.Current; // If nothing is stated about id then include it in toString() if (field.Identifier && field.getMeta("use-in-tostring") == null) { writer.WriteLine(" sb.AppendFormat(\"{0}={{0}} \", {0});", field.fieldcase); } else if (field.getMetaAsBool("use-in-tostring")) { writer.WriteLine(" sb.AppendFormat(\"{0}={{0}} \", {0});", field.fieldcase); } } writer.WriteLine(" return sb.ToString();"); writer.WriteLine(" }"); writer.WriteLine(); } internal static System.Collections.IDictionary primitiveToObject; public virtual int doFieldAccessors(ClassMapping classMapping, System.Collections.IDictionary class2classmap, System.IO.StringWriter writer, System.String vetoSupport, System.String changeSupport) { int fieldTypes = ORDINARY; if (classMapping.SuperInterface) { fieldTypes = doFields(classMapping, class2classmap, writer, vetoSupport, changeSupport, fieldTypes, classMapping.AllFields); } SupportClass.ListCollectionSupport fieldz = classMapping.Fields; fieldTypes = doFields(classMapping, class2classmap, writer, vetoSupport, changeSupport, fieldTypes, fieldz); return fieldTypes; } private int doFields(ClassMapping classMapping, System.Collections.IDictionary class2classmap, System.IO.StringWriter writer, System.String vetoSupport, System.String changeSupport, int fieldTypes, SupportClass.ListCollectionSupport fieldz) { // field accessors for (System.Collections.IEnumerator fields = fieldz.GetEnumerator(); fields.MoveNext(); ) { FieldProperty field = (FieldProperty) fields.Current; if (field.GeneratedAsProperty) { // getter System.String getAccessScope = getFieldScope(field, "scope-get", "public"); if (field.getMeta("field-description") != null) { //writer.WriteLine(" /** \n" + javaTool.toJavaDoc(field.getMetaAsString("field-description"), 4) + " */"); writer.WriteLine(" /// <summary>\n" + javaTool.toJavaDoc(field.getMetaAsString("field-description"), 4) + "\n /// </summary>"); } writer.Write(" " + getAccessScope + " " + field.FullyQualifiedTypeName + " " + field.propcase); if (classMapping.Interface) { writer.WriteLine(";"); } else { writer.WriteLine(); writer.WriteLine(" {"); writer.WriteLine(" get { return this." + field.fieldcase + "; }"); //writer.WriteLine(" {"); //writer.WriteLine(" return this." + field.FieldName + ";"); //writer.WriteLine(" }"); } // setter int fieldType = 0; if (field.getMeta("beans-property-type") != null) { System.String beansPropertyType = field.getMetaAsString("beans-property-type").Trim().ToLower(); if (beansPropertyType.Equals("constraint")) { fieldTypes = (fieldTypes | CONSTRAINT); fieldType = CONSTRAINT; } else if (beansPropertyType.Equals("bound")) { fieldTypes = (fieldTypes | BOUND); fieldType = BOUND; } } System.String setAccessScope = getFieldScope(field, "scope-set", "public"); writer.Write(" set"); writer.Write((fieldType & CONSTRAINT) == CONSTRAINT?" throws PropertyVetoException ":""); if (classMapping.Interface) { writer.WriteLine(";"); } else { writer.WriteLine(); writer.WriteLine(" {"); if ((fieldType & CONSTRAINT) == CONSTRAINT || (fieldType & BOUND) == BOUND) { writer.WriteLine(" Object oldValue = " + getFieldAsObject(true, field) + ";"); } if ((fieldType & CONSTRAINT) == CONSTRAINT) { writer.WriteLine(" " + vetoSupport + ".fireVetoableChange(\"" + field.fieldcase + "\","); writer.WriteLine(" oldValue,"); writer.WriteLine(" " + getFieldAsObject(false, field) + ");"); } writer.WriteLine(" this." + field.fieldcase + " = value;"); if ((fieldType & BOUND) == BOUND) { writer.WriteLine(" " + changeSupport + ".firePropertyChange(\"" + field.fieldcase + "\","); writer.WriteLine(" oldValue,"); writer.WriteLine(" " + getFieldAsObject(false, field) + ");"); } writer.WriteLine(" }"); } writer.WriteLine(" }"); writer.WriteLine(); // add/remove'rs (commented out for now) /* if(field.getForeignClass()!=null) { ClassName foreignClass = field.getForeignClass(); String trueforeign = getTrueTypeName(foreignClass, class2classmap); classMapping.addImport(trueforeign); // Try to identify the matching set method on the child. ClassMapping forignMap = (ClassMapping) class2classmap.get(foreignClass.getFullyQualifiedName()); if(forignMap!=null) { Iterator foreignFields = forignMap.getFields().iterator(); while (foreignFields.hasNext()) { Field ffield = (Field) foreignFields.next(); if(ffield.isIdentifier()) { log.Debug("Trying to match " + ffield.getName() + " with " + field.getForeignKeys()); } } } else { log.Error("Could not find foreign class's mapping - cannot provide bidirectional setters!"); } String addAccessScope = getFieldScope(field, "scope", "scope-add"); writer.println(" " + setAccessScope + " void add" + field.getAsSuffix() + StringHelper.OPEN + shortenType(trueforeign, classMapping.getImports()) + " a" + field.getName() + ") {"); writer.println(" this." + getterType + field.getAsSuffix() + "().add(a" + field.getName() + ");"); writer.println(" a" + field.getName() + ".setXXX(this);"); writer.println(" }"); writer.println(); } */ } } return fieldTypes; } public virtual void doImports(ClassMapping classMapping, System.IO.StreamWriter writer) { writer.WriteLine(javaTool.genImports(classMapping)); writer.WriteLine(); } protected internal virtual System.String makeSupportField(System.String fieldName, SupportClass.ListCollectionSupport fieldList) { System.String suffix = ""; bool needSuffix = false; for (System.Collections.IEnumerator fields = fieldList.GetEnumerator(); fields.MoveNext(); ) { System.String name = ((FieldProperty) fields.Current).FieldName; if (name.Equals(fieldName)) needSuffix = true; suffix += name; } return needSuffix?fieldName + "_" + suffix:fieldName; } private System.String getFieldAsObject(bool prependThis, FieldProperty field) { ClassName type = field.ClassType; if (type != null && type.Primitive && !type.Array) { System.String typeName = (System.String) primitiveToObject[type.Name]; typeName = "new " + typeName + "( "; typeName += (prependThis?"this.":""); return typeName + field.FieldName + " )"; } return (prependThis?"this.":"") + field.FieldName; } static BasicRenderer() { primitiveToObject = new System.Collections.Hashtable(); } } } --- NEW FILE: ClassMapping.cs --- 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 { public class ClassMapping:MappingElement { private static readonly ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private void InitBlock() { fields = new SupportClass.ListCollectionSupport(); imports = new SupportClass.TreeSetSupport(); subclasses = new SupportClass.ListCollectionSupport(); } virtual public SupportClass.ListCollectionSupport Fields { get { return fields; } } virtual public SupportClass.SetSupport Imports { get { return imports; } } /// <summary>shorthand method for getClassName().getFullyQualifiedName() </summary> virtual public String FullyQualifiedName { get { return ClassName.FullyQualifiedName; } } /// <summary>shorthand method for getClassName().getName() </summary> virtual public String Name { get { return ClassName.Name; } } /// <summary>shorthand method for getClassName().getPackageName() </summary> virtual public String PackageName { get { return ClassName.PackageName; } } virtual public ClassName ClassName { get { return name; } } virtual public String GeneratedName { get { return generatedName.Name; } } virtual public String GeneratedPacka... [truncated message content] |
From: Michael D. <mik...@us...> - 2004-12-30 16:55:04
|
Update of /cvsroot/nhibernate/NHibernateContrib/src/NHibernate.Tasks In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26138/NHibernate.Tasks Added Files: .cvsignore AssemblyInfo.cs Hbm2NetTask.cs NHibernate.Tasks-1.1.csproj NHibernate.Tasks.build Log Message: Moved NHibernate.Tasks and NHibernate.Tool.hbm2net over to the NHibernateContrib module. --- NEW FILE: .cvsignore --- bin obj .#* *.user *.xsx --- NEW FILE: NHibernate.Tasks-1.1.csproj --- <VisualStudioProject> <CSHARP ProjectType = "Local" ProductVersion = "7.10.3077" SchemaVersion = "2.0" ProjectGuid = "{C6F085E3-17FA-424A-9A09-143F3E177FEB}" > <Build> <Settings ApplicationIcon = "" AssemblyKeyContainerName = "" AssemblyName = "NHibernate.Tasks" AssemblyOriginatorKeyFile = "" DefaultClientScript = "JScript" DefaultHTMLPageLayout = "Grid" DefaultTargetSchema = "IE50" DelaySign = "false" OutputType = "Library" PreBuildEvent = "" PostBuildEvent = "" RootNamespace = "NHibernate.Tasks" RunPostBuildEvent = "OnBuildSuccess" StartupObject = "" > <Config Name = "Debug" AllowUnsafeBlocks = "false" BaseAddress = "285212672" CheckForOverflowUnderflow = "false" ConfigurationOverrideFile = "" DefineConstants = "DEBUG;TRACE" DocumentationFile = "" DebugSymbols = "true" FileAlignment = "4096" IncrementalBuild = "false" NoStdLib = "false" NoWarn = "" Optimize = "false" OutputPath = "bin\Debug\" RegisterForComInterop = "false" RemoveIntegerChecks = "false" TreatWarningsAsErrors = "false" WarningLevel = "4" /> <Config Name = "Release" AllowUnsafeBlocks = "false" BaseAddress = "285212672" CheckForOverflowUnderflow = "false" ConfigurationOverrideFile = "" DefineConstants = "TRACE" DocumentationFile = "" DebugSymbols = "false" FileAlignment = "4096" IncrementalBuild = "false" NoStdLib = "false" NoWarn = "" Optimize = "true" OutputPath = "bin\Release\" RegisterForComInterop = "false" RemoveIntegerChecks = "false" TreatWarningsAsErrors = "false" WarningLevel = "4" /> </Settings> <References> <Reference Name = "System" AssemblyName = "System" HintPath = "..\..\..\..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.dll" /> <Reference Name = "System.Data" AssemblyName = "System.Data" HintPath = "..\..\..\..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Data.dll" /> <Reference Name = "System.XML" AssemblyName = "System.Xml" HintPath = "..\..\..\..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.XML.dll" /> <Reference Name = "log4net" AssemblyName = "log4net" HintPath = "..\..\lib\net\1.1\log4net.dll" /> <Reference Name = "NAnt.Core" AssemblyName = "NAnt.Core" HintPath = "..\..\lib\NAnt.Core.dll" /> <Reference Name = "NHibernate" AssemblyName = "NHibernate" HintPath = "..\..\lib\net\1.1\NHibernate.dll" /> </References> </Build> <Files> <Include> <File RelPath = "AssemblyInfo.cs" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "Hbm2NetTask.cs" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "NHibernate.Tasks.build" BuildAction = "None" /> </Include> </Files> </CSHARP> </VisualStudioProject> --- NEW FILE: AssemblyInfo.cs --- using System.Reflection; using System.Runtime.CompilerServices; //------------------------------------------------------------------------------ // <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 // the code is regenerated. // </autogenerated> //------------------------------------------------------------------------------ [assembly: AssemblyTitleAttribute("NHibernate.Tasks for Microsoft .NET Framework 1.1")] [assembly: AssemblyDescriptionAttribute("NAnt Tasks for NHibernate Tools.")] [assembly: AssemblyCompanyAttribute("nhibernate.sourceforge.net")] [assembly: AssemblyProductAttribute("NHibernate.Tasks")] [assembly: AssemblyCopyrightAttribute("Licensed under LGPL.")] [assembly: AssemblyVersionAttribute("0.5.0.0")] [assembly: AssemblyInformationalVersionAttribute("0.5")] [assembly: AssemblyFileVersionAttribute("0.5.0.0")] [assembly: AssemblyDelaySignAttribute(false)] --- NEW FILE: NHibernate.Tasks.build --- <project name="NHibernate.Tasks" default="build" xmlns="http://nant.sf.net/schemas/nant-0.84.win32.net-1.0.xsd" > <!-- Required properties: * build.dir - (path) root level to build to, assemblies will go in ${build.dir}/bin * build.debug - (true|false) debug build? * current.build.defines - framework-specific build defines * project.version - full project version * project.version.major - the major number of the build * project.version.minor - the minor number of the build * project.version.build - the build number --> <target name="build" description="NAnt Tasks that use NHibernate's Toolset."> <!-- ensure the AssemblyInfo is writable --> <attrib file="AssemblyInfo.cs" readonly="false" /> <asminfo output="AssemblyInfo.cs" language="CSharp"> <imports> <import name="System.Reflection" /> <import name="System.Runtime.CompilerServices" /> </imports> <attributes> <attribute type="AssemblyTitleAttribute" value="${nant.project.name} for ${current.runtime.description}" /> <attribute type="AssemblyDescriptionAttribute" value="NAnt Tasks for NHibernate Tools." /> <attribute type="AssemblyCompanyAttribute" value="nhibernate.sourceforge.net" /> <attribute type="AssemblyProductAttribute" value="${nant.project.name}" /> <attribute type="AssemblyCopyrightAttribute" value="Licensed under LGPL." /> <attribute type="AssemblyVersionAttribute" value="${project.version}" /> <attribute type="AssemblyInformationalVersionAttribute" value="${project.version.major}.${project.version.minor}" /> <attribute type="AssemblyFileVersionAttribute" value="${project.version}" /> <attribute type="AssemblyDelaySignAttribute" value="false" /> </attributes> </asminfo> <csc output="${build.dir}/bin/${nant.project.name}.dll" define="${current.build.defines}" target="library" debug="${build.debug}" doc="${build.dir}/bin/${nant.project.name}.xml" nowarn="1591" > <sources failonempty="true"> <includes name="*.cs" /> </sources> <references basedir="${build.dir}/bin"> <includes name="System.dll" /> <includes name="DotNetMock.dll" /> <includes name="NHibernate.dll" /> <includes name="NAnt.Core.dll" /> <includes name="log4net.dll" /> </references> </csc> </target> </project> --- NEW FILE: Hbm2NetTask.cs --- using System.IO; using System.Text; using NAnt.Core.Attributes; using NAnt.Core.Tasks; using NAnt.Core.Types; namespace NHibernate.Tasks { [TaskName( "hbm2net" )] public class Hbm2NetTask : ExternalProgramBase { private FileSet _set = new FileSet(); private string _output = null; private string _config = null; private string _args = null; [BuildElement( "fileset", Required=true )] public FileSet Hbm2NetFileSet { get { return _set; } set { _set = value; } } [TaskAttribute( "output" )] public string Output { get { return _output; } set { _output = value; } } [TaskAttribute( "config" )] public string Config { get { return _config; } set { _config = value; } } public override string ExeName { get { string asm = this.GetType().Assembly.Location; string basename = asm.Substring( 0, asm.LastIndexOf( Path.DirectorySeparatorChar ) + 1 ); return basename + "NHibernate.Tool.hbm2net.exe"; } } public override string ProgramArguments { get { return _args; } } protected override void ExecuteTask() { StringBuilder sb = new StringBuilder(); if( _output != null ) { sb.Append( "--output=\"" + _output + "\" " ); } if( _config != null ) { sb.Append( "--config=\"" + _config + "\" " ); } foreach( string filename in _set.FileNames ) { sb.Append( "\"" + filename + "\" " ); } _args = sb.ToString(); base.ExecuteTask(); } } } |
Update of /cvsroot/nhibernate/NHibernateContrib/src/NHibernate.Tool.Net2Hbm In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25861/NHibernate.Tool.Net2Hbm Added Files: .cvsignore AssemblyInfo.cs CascadeType.cs ClassAttribute.cs ClassPolymorphismType.cs CollectionCompositeElementAttribute.cs CollectionIndexAttribute.cs CollectionKeyAttribute.cs CollectionManyToManyAttribute.cs DiscriminatorAttribute.cs IdAttribute.cs JoinedSubclassAttribute.cs JoinedSubclassKeyAttribute.cs ListAttribute.cs ManyToOneAttribute.cs MapGenerator.cs NHibernate.Tool.Net2Hbm-1.1.csproj NHibernate.Tool.Net2Hbm.build OuterJoinType.cs PropertyAttribute.cs SetAttribute.cs Size.cs SubclassAttribute.cs TypeKey.cs TypeNode.cs TypeNodeCollection.cs UnsavedValueType.cs VersionAttribute.cs Log Message: Added code from John Morris to enable mapping through attributes instead of xml files. --- NEW FILE: ListAttribute.cs --- using System; namespace NHibernate.Tool.Net2Hbm { /// <summary> /// Summary description for ListAttribute. /// </summary> [AttributeUsage(AttributeTargets.Property)] public class ListAttribute : Attribute { #region Member Variables private string m_Table; private string m_Schema; private bool m_IsLazy; private bool m_IsInverse; private CascadeType m_Cascade = CascadeType.None; private string m_SqlWhere; #endregion /// <summary> /// Class constructor. /// </summary> public ListAttribute( string table ) { this.Table = table; } /// <summary> /// Gets and sets the Table. /// </summary> public string Table { get { return m_Table; } set { m_Table = value; } } /// <summary> /// Gets and sets the IsInverse. /// </summary> public bool IsInverse { get { return m_IsInverse; } set { m_IsInverse = value; } } /// <summary> /// Gets and sets the Schema. /// </summary> public string Schema { get { return m_Schema; } set { m_Schema = value; } } /// <summary> /// Gets and sets the IsLazy. /// </summary> public bool IsLazy { get { return m_IsLazy; } set { m_IsLazy = value; } } /// <summary> /// Gets and sets the Cascade. /// </summary> public CascadeType Cascade { get { return m_Cascade; } set { m_Cascade = value; } } /// <summary> /// Gets and sets the SqlWhere. /// </summary> public string SqlWhere { get { return m_SqlWhere; } set { m_SqlWhere = value; } } } } --- NEW FILE: TypeKey.cs --- using System; namespace NHibernate.Tool.Net2Hbm { /// <summary> /// Summary description for TypeKey. /// </summary> internal class TypeKey : IComparable { #region Member Variables private System.Type m_Type; private System.Type m_ExtendsType; #endregion /// <summary> /// Class constructor. /// </summary> public TypeKey( System.Type type ) { m_Type = type; m_ExtendsType = FindExtendsType( type ); } /// <summary> /// Searchs the class hieracrhy for the first class with an attribute that we are looking for. /// </summary> /// <param name="type"></param> /// <returns></returns> private System.Type FindExtendsType( System.Type type ) { //check for joined subclass JoinedSubclassAttribute joinedSubclassAttr = (JoinedSubclassAttribute)Attribute.GetCustomAttribute( type, typeof(JoinedSubclassAttribute), false ); if( joinedSubclassAttr != null ) { if( joinedSubclassAttr.Extends != null ) { return joinedSubclassAttr.Extends; } else { return type.BaseType; } } else //check for subclass { SubclassAttribute subclassAttr = (SubclassAttribute)Attribute.GetCustomAttribute( type, typeof(SubclassAttribute), false ); if( subclassAttr != null ) { if( subclassAttr.Extends != null ) { return subclassAttr.Extends; } else { return type.BaseType; } } else //look to the base class { if( type.BaseType != null ) return FindExtendsType( type.BaseType ); else return null; } } } /// <summary> /// Gets and sets the Type. /// </summary> public System.Type Type { get { return m_Type; } } /// <summary> /// Gets and sets the ExtendsType. /// </summary> public System.Type ExtendsType { get { return m_ExtendsType; } } #region IComparable Members /// <summary> /// Compares the two objects. /// </summary> /// <param name="obj"></param> /// <returns></returns> public int CompareTo( object obj ) { if( obj is TypeKey ) { TypeKey other = (TypeKey)obj; if( this.Type == other.Type ) { return 0; } else if( this.ExtendsType == other.Type ) { return 1; } else if( other.ExtendsType == this.Type ) { return -1; } else { return -1; } } else { throw new ArgumentException(); } } #endregion } } --- NEW FILE: PropertyAttribute.cs --- using System; namespace NHibernate.Tool.Net2Hbm { /// <summary> /// Summary description for PropertyAttribute. /// </summary> [AttributeUsage(AttributeTargets.Property)] public class PropertyAttribute : Attribute { #region Member Variables private string m_Column; private System.Type m_Type; private bool m_Update = true; private bool m_Insert = true; private string m_Formula; private int m_Size; #endregion /// <summary> /// Class constructor. /// </summary> public PropertyAttribute() { } /// <summary> /// Class constructor. /// </summary> /// <param name="type"></param> public PropertyAttribute( System.Type type ) { this.Type = type; } /// <summary> /// Class constructor. /// </summary> /// <param name="column"></param> /// <param name="type"></param> public PropertyAttribute( string column, System.Type type ) : this( column ) { this.Type = type; } /// <summary> /// Class constructor. /// </summary> /// <param name="column"></param> /// <param name="type"></param> /// <param name="size"></param> public PropertyAttribute( string column, System.Type type, int size ) : this( column, size ) { this.Type = type; } /// <summary> /// Class constructor. /// </summary> /// <param name="size"></param> public PropertyAttribute( int size ) { this.Size = size; } /// <summary> /// Class constructor. /// </summary> public PropertyAttribute( string column ) { this.Column = column; } /// <summary> /// Class constructor. /// </summary> /// <param name="column"></param> /// <param name="size"></param> public PropertyAttribute( string column, int size ) : this( column ) { this.Size = size; } /// <summary> /// Gets and sets the Size. /// </summary> public int Size { get { return m_Size; } set { m_Size = value; } } /// <summary> /// Gets and sets the Column. /// </summary> public string Column { get { return m_Column; } set { m_Column = value; } } /// <summary> /// Gets and sets the Type. /// </summary> public System.Type Type { get { return m_Type; } set { m_Type = value; } } /// <summary> /// Gets and sets the Update. /// </summary> public bool Update { get { return m_Update; } set { m_Update = value; } } /// <summary> /// Gets and sets the Insert. /// </summary> public bool Insert { get { return m_Insert; } set { m_Insert = value; } } /// <summary> /// Gets and sets the Formula. /// </summary> public string Formula { get { return m_Formula; } set { m_Formula = value; } } } } --- NEW FILE: IdAttribute.cs --- using System; namespace NHibernate.Tool.Net2Hbm { /// <summary> /// Summary description for IdAttribute. /// </summary> [AttributeUsage(AttributeTargets.Property)] public class IdAttribute : Attribute { #region Member Variables private string m_Column; private UnsavedValueType m_UnsavedValueType = UnsavedValueType.Null; private string m_UnsavedValue; private System.Type m_Generator; #endregion /// <summary> /// Class constructor. /// </summary> public IdAttribute( string column, System.Type generator ) { this.Column = column; this.Generator = generator; } /// <summary> /// Gets and sets the Column. /// </summary> public string Column { get { return m_Column; } set { m_Column = value; } } /// <summary> /// Gets and sets the UnsavedValueType. /// </summary> public UnsavedValueType UnsavedValueType { get { return m_UnsavedValueType; } set { m_UnsavedValueType = value; } } /// <summary> /// Gets and sets the UnsavedValue. /// </summary> public string UnsavedValue { get { return m_UnsavedValue; } set { m_UnsavedValue = value; } } /// <summary> /// Gets and sets the Generator. /// </summary> public System.Type Generator { get { return m_Generator; } set { m_Generator = value; } } } } --- NEW FILE: SetAttribute.cs --- using System; namespace NHibernate.Tool.Net2Hbm { /// <summary> /// Summary description for SetAttribute. /// </summary> [AttributeUsage(AttributeTargets.Property)] public class SetAttribute : Attribute { #region Member Variables private string m_Table; private string m_Schema; private bool m_IsLazy; private CascadeType m_Cascade = CascadeType.None; private string m_SqlWhere; #endregion /// <summary> /// Class constructor. /// </summary> public SetAttribute( string table ) { this.Table = table; } /// <summary> /// Gets and sets the Table. /// </summary> public string Table { get { return m_Table; } set { m_Table = value; } } /// <summary> /// Gets and sets the Schema. /// </summary> public string Schema { get { return m_Schema; } set { m_Schema = value; } } /// <summary> /// Gets and sets the IsLazy. /// </summary> public bool IsLazy { get { return m_IsLazy; } set { m_IsLazy = value; } } /// <summary> /// Gets and sets the Cascade. /// </summary> public CascadeType Cascade { get { return m_Cascade; } set { m_Cascade = value; } } /// <summary> /// Gets and sets the SqlWhere. /// </summary> public string SqlWhere { get { return m_SqlWhere; } set { m_SqlWhere = value; } } } } --- NEW FILE: ManyToOneAttribute.cs --- using System; namespace NHibernate.Tool.Net2Hbm { /// <summary> /// Summary description for ManyToOneAttribute. /// </summary> [AttributeUsage(AttributeTargets.Property)] public class ManyToOneAttribute : Attribute { #region Member Variables private string m_Column; private System.Type m_Type; private bool m_Update = true; private bool m_Insert = true; private OuterJoinType m_OuterJoin; private CascadeType m_Cascade; private bool m_Inheritable = true; #endregion /// <summary> /// Class constructor. /// </summary> /// <param name="type"></param> public ManyToOneAttribute( System.Type type ) { this.Type = type; } /// <summary> /// Class constructor. /// </summary> public ManyToOneAttribute( string column ) { this.Column = column; } /// <summary> /// Class constructor. /// </summary> public ManyToOneAttribute( string column, System.Type type ) : this( column ) { this.Type = type; } /// <summary> /// Gets and sets the Column. /// </summary> public string Column { get { return m_Column; } set { m_Column = value; } } /// <summary> /// Gets and sets the Update. /// </summary> public bool Update { get { return m_Update; } set { m_Update = value; } } /// <summary> /// Gets and sets the Insert. /// </summary> public bool Insert { get { return m_Insert; } set { m_Insert = value; } } /// <summary> /// Gets and sets the OuterJoin. /// </summary> public OuterJoinType OuterJoin { get { return m_OuterJoin; } set { m_OuterJoin = value; } } /// <summary> /// Gets and sets the Cascade. /// </summary> public CascadeType Cascade { get { return m_Cascade; } set { m_Cascade = value; } } /// <summary> /// Gets and sets the Inheritable. /// </summary> public bool Inheritable { get { return m_Inheritable; } set { m_Inheritable = value; } } /// <summary> /// Gets and sets the Type. /// </summary> public System.Type Type { get { return m_Type; } set { m_Type = value; } } } } --- NEW FILE: Size.cs --- using System; namespace NHibernate.Tool.Net2Hbm { /// <summary> /// Summary description for Size. /// </summary> public class Size { #region Member Variables public const int Max = 2147483647; #endregion /// <summary> /// Class constructor. /// </summary> private Size() { } } } --- NEW FILE: AssemblyInfo.cs --- using System.Reflection; using System.Runtime.CompilerServices; //------------------------------------------------------------------------------ // <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 // the code is regenerated. // </autogenerated> //------------------------------------------------------------------------------ [assembly: AssemblyTitleAttribute("NHibernate.Tool.Net2Hbm for Microsoft .NET Framework 1.1")] [assembly: AssemblyDescriptionAttribute("An attribute library which provides support for custom attributes that can be use" + "d in the generation of NHibernate mapping files.")] [assembly: AssemblyCompanyAttribute("nhibernate.sourceforge.net")] [assembly: AssemblyProductAttribute("NHibernate.Tool.Net2Hbm")] [assembly: AssemblyCopyrightAttribute("Licensed under LGPL.")] [assembly: AssemblyVersionAttribute("0.5.0.0")] [assembly: AssemblyInformationalVersionAttribute("0.5")] [assembly: AssemblyFileVersionAttribute("0.5.0.0")] //[assembly: AssemblyKeyFileAttribute("..\\NHibernate.snk")] --- NEW FILE: CollectionKeyAttribute.cs --- using System; namespace NHibernate.Tool.Net2Hbm { /// <summary> /// Summary description for CollectionKeyAttribute. /// </summary> [AttributeUsage(AttributeTargets.Property)] public class CollectionKeyAttribute : Attribute { #region Member Variables private string m_Column; #endregion /// <summary> /// Class constructor. /// </summary> public CollectionKeyAttribute( string column ) { this.Column = column; } /// <summary> /// Gets and sets the Column. /// </summary> public string Column { get { return m_Column; } set { m_Column = value; } } } } --- NEW FILE: UnsavedValueType.cs --- using System; using System.Xml.Serialization; namespace NHibernate.Tool.Net2Hbm { /// <summary> /// Summary description for UnsavedValueType. /// </summary> public enum UnsavedValueType { [XmlEnum("null")] Null, [XmlEnum("any")] Any, [XmlEnum("none")] None, Specified } } --- NEW FILE: ClassPolymorphismType.cs --- using System; namespace NHibernate.Tool.Net2Hbm { /// <summary> /// Summary description for ClassPolymorphismType. /// </summary> public enum ClassPolymorphismType { Implicit = 0, Explicit = 1 } } --- NEW FILE: NHibernate.Tool.Net2Hbm-1.1.csproj --- <VisualStudioProject> <CSHARP ProjectType = "Local" ProductVersion = "7.10.3077" SchemaVersion = "2.0" ProjectGuid = "{FD72BBE4-AA77-459A-9F1D-6B7C7143CF2A}" > <Build> <Settings ApplicationIcon = "" AssemblyKeyContainerName = "" AssemblyName = "NHibernate.Tool.Net2Hbm" AssemblyOriginatorKeyFile = "" DefaultClientScript = "JScript" DefaultHTMLPageLayout = "Grid" DefaultTargetSchema = "IE50" DelaySign = "false" OutputType = "Library" PreBuildEvent = "" PostBuildEvent = "" RootNamespace = "NHibernate.Tool.Net2Hbm" RunPostBuildEvent = "OnBuildSuccess" StartupObject = "" > <Config Name = "Debug" AllowUnsafeBlocks = "false" BaseAddress = "285212672" CheckForOverflowUnderflow = "false" ConfigurationOverrideFile = "" DefineConstants = "DEBUG;TRACE" DocumentationFile = "" DebugSymbols = "true" FileAlignment = "4096" IncrementalBuild = "false" NoStdLib = "false" NoWarn = "" Optimize = "false" OutputPath = "bin\Debug\" RegisterForComInterop = "false" RemoveIntegerChecks = "false" TreatWarningsAsErrors = "false" WarningLevel = "4" /> <Config Name = "Release" AllowUnsafeBlocks = "false" BaseAddress = "285212672" CheckForOverflowUnderflow = "false" ConfigurationOverrideFile = "" DefineConstants = "TRACE" DocumentationFile = "" DebugSymbols = "false" FileAlignment = "4096" IncrementalBuild = "false" NoStdLib = "false" NoWarn = "" Optimize = "true" OutputPath = "bin\Release\" RegisterForComInterop = "false" RemoveIntegerChecks = "false" TreatWarningsAsErrors = "false" WarningLevel = "4" /> </Settings> <References> <Reference Name = "System" AssemblyName = "System" HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.dll" /> <Reference Name = "System.Data" AssemblyName = "System.Data" HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Data.dll" /> <Reference Name = "System.XML" AssemblyName = "System.Xml" HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.XML.dll" /> </References> </Build> <Files> <Include> <File RelPath = "AssemblyInfo.cs" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "CascadeType.cs" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "ClassAttribute.cs" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "ClassPolymorphismType.cs" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "CollectionCompositeElementAttribute.cs" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "CollectionIndexAttribute.cs" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "CollectionKeyAttribute.cs" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "CollectionManyToManyAttribute.cs" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "DiscriminatorAttribute.cs" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "IdAttribute.cs" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "JoinedSubclassAttribute.cs" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "JoinedSubclassKeyAttribute.cs" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "ListAttribute.cs" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "ManyToOneAttribute.cs" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "MapGenerator.cs" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "NHibernate.Tool.Net2Hbm.build" BuildAction = "None" /> <File RelPath = "OuterJoinType.cs" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "PropertyAttribute.cs" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "SetAttribute.cs" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "Size.cs" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "SubclassAttribute.cs" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "TypeKey.cs" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "TypeNode.cs" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "TypeNodeCollection.cs" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "UnsavedValueType.cs" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "VersionAttribute.cs" SubType = "Code" BuildAction = "Compile" /> </Include> </Files> </CSHARP> </VisualStudioProject> --- NEW FILE: CascadeType.cs --- using System; using System.Xml.Serialization; namespace NHibernate.Tool.Net2Hbm { /// <summary> /// Summary description for Cascade. /// </summary> public enum CascadeType { [XmlEnum("none")] None, [XmlEnum("all")] All, [XmlEnum("save-update")] SaveUpdate, [XmlEnum("delete")] Delete } } --- NEW FILE: NHibernate.Tool.Net2Hbm.build --- <?xml version="1.0" ?> <project name="NHibernate.Tool.Net2Hbm" default="build" xmlns="http://nant.sf.net/schemas/nant-0.84.win32.net-1.0.xsd" > <!-- Required properties: * build.dir - (path) root level to build to, assemblies will go in ${build.dir}/bin * build.debug - (true|false) debug build? * current.build.defines - framework-specific build defines * project.version - full project version * project.version.major - the major number of the build * project.version.minor - the minor number of the build * project.version.build - the build number * sign - (true|false)indicates if the Assembly should be signed. * clover.enabled - (true|false) indicates if Clover.NET should handle the build * clover.src - location of the clovered source to be stored at from the root of NHibernateContrib * clover.db - location of the coverage db from the root of NHibernateContrib --> <if propertytrue="clover.enabled"> <loadtasks assembly="${clover.home}/CloverNAnt-0.84.dll" /> </if> <property name="keyFile" value="..\NHibernate.snk" /> <target name="build" description="Build NHibernate.Tool.Net2Hbm"> <if propertytrue="clover.enabled"> <clover-setup initstring="..\..\${clover.db}" builddir="..\..\${clover.src}\${nant.project.name}" enabled="${clover.enabled}" flushinterval="1000" /> </if> <!-- ensure the AssemblyInfo is writable --> <attrib file="AssemblyInfo.cs" readonly="false" /> <asminfo output="AssemblyInfo.cs" language="CSharp"> <imports> <import name="System.Reflection" /> <import name="System.Runtime.CompilerServices" /> </imports> <attributes> <attribute type="AssemblyTitleAttribute" value="${nant.project.name} for ${current.runtime.description}" /> <attribute type="AssemblyDescriptionAttribute" value="An attribute library which provides support for custom attributes that can be used in the generation of NHibernate mapping files." /> <attribute type="AssemblyCompanyAttribute" value="nhibernate.sourceforge.net" /> <attribute type="AssemblyProductAttribute" value="${nant.project.name}" /> <attribute type="AssemblyCopyrightAttribute" value="Licensed under LGPL." /> <attribute type="AssemblyVersionAttribute" value="${project.version}" /> <attribute type="AssemblyInformationalVersionAttribute" value="${project.version.major}.${project.version.minor}" /> <attribute type="AssemblyFileVersionAttribute" value="${project.version}" /> <attribute type="AssemblyKeyFileAttribute" value="${keyFile}" if="${sign}"/> </attributes> </asminfo> <csc target="library" define="${current.build.defines}" debug="${build.debug}" output="${build.dir}/bin/${nant.project.name}.dll" doc="${build.dir}/bin/${nant.project.name}.xml" > <sources failonempty="true"> <includes name="**/*.cs" /> </sources> <references basedir="${build.dir}/bin"> <includes name="${nant.settings.currentframework.frameworkassemblydirectory}/System.dll" /> <includes name="${nant.settings.currentframework.frameworkassemblydirectory}/System.Data.dll" /> <includes name="${nant.settings.currentframework.frameworkassemblydirectory}/System.XML.dll" /> </references> </csc> </target> </project> --- NEW FILE: CollectionIndexAttribute.cs --- using System; namespace NHibernate.Tool.Net2Hbm { /// <summary> /// Summary description for CollectionIndexAttribute. /// </summary> [AttributeUsage(AttributeTargets.Property)] public class CollectionIndexAttribute : Attribute { #region Member Variables private string m_Column; #endregion /// <summary> /// Class constructor. /// </summary> public CollectionIndexAttribute( string column ) { this.Column = column; } /// <summary> /// Gets and sets the Column. /// </summary> public string Column { get { return m_Column; } set { m_Column = value; } } } } --- NEW FILE: TypeNode.cs --- using System; namespace NHibernate.Tool.Net2Hbm { /// <summary> /// Summary description for TypeNode. /// </summary> internal class TypeNode { #region Member Variables private System.Type m_Type; private TypeNodeCollection m_Nodes; #endregion /// <summary> /// Class constructor. /// </summary> public TypeNode( System.Type type ) { m_Type = type; m_Nodes = new TypeNodeCollection(); } /// <summary> /// Gets and sets the Nodes. /// </summary> public TypeNodeCollection Nodes { get { return m_Nodes; } } /// <summary> /// Gets and sets the Type. /// </summary> public System.Type Type { get { return m_Type; } set { m_Type = value; } } } } --- NEW FILE: .cvsignore --- bin obj .#* *.user *.xsx --- NEW FILE: JoinedSubclassAttribute.cs --- using System; namespace NHibernate.Tool.Net2Hbm { /// <summary> /// Summary description for JoinedSubclassAttribute. /// </summary> [AttributeUsage(AttributeTargets.Class)] public class JoinedSubclassAttribute : Attribute { #region Member Variables private System.Type m_Extends; // private System.Type m_Proxy; private bool m_DynamicUpdate; private bool m_DynamicInsert; private string m_Table; #endregion /// <summary> /// Class constructor. /// </summary> public JoinedSubclassAttribute( string table ) { this.Table = table; } /// <summary> /// Class constructor. /// </summary> /// <param name="table"></param> /// <param name="extends"></param> public JoinedSubclassAttribute( string table, System.Type extends ) : this( table ) { this.Extends = extends; } /// <summary> /// Gets and sets the Table. /// </summary> public string Table { get { return m_Table; } set { m_Table = value; } } /// <summary> /// Gets and sets the Extends. /// </summary> public System.Type Extends { get { return m_Extends; } set { m_Extends = value; } } /// <summary> /// Gets and sets the DynamicUpdate. /// </summary> public bool DynamicUpdate { get { return m_DynamicUpdate; } set { m_DynamicUpdate = value; } } /// <summary> /// Gets and sets the DynamicInsert. /// </summary> public bool DynamicInsert { get { return m_DynamicInsert; } set { m_DynamicInsert = value; } } // /// <summary> // /// Gets and sets the Proxy. // /// </summary> // public System.Type Proxy // { // get { return m_Proxy; } // set { m_Proxy = value; } // } } } --- NEW FILE: OuterJoinType.cs --- using System; using System.Xml.Serialization; namespace NHibernate.Tool.Net2Hbm { /// <summary> /// Summary description for OuterJoinType. /// </summary> public enum OuterJoinType { [XmlEnum("auto")] Auto, [XmlEnum("true")] True, [XmlEnum("false")] False } } --- NEW FILE: ClassAttribute.cs --- using System; namespace NHibernate.Tool.Net2Hbm { /// <summary> /// Summary description for ClassAttribute. /// </summary> [AttributeUsage(AttributeTargets.Class)] public class ClassAttribute : Attribute { #region Member Variables private string m_Table; private bool m_Mutable; private string m_Schema; private string m_DiscriminatorValue; // private System.Type m_Proxy; private bool m_DynamicUpdate; private bool m_DynamicInsert; private ClassPolymorphismType m_Polymorphism = ClassPolymorphismType.Implicit; private string m_SqlWhere; private System.Type m_Persister; #endregion /// <summary> /// Class constructor. /// </summary> public ClassAttribute( string table ) { this.Table = table; } /// <summary> /// Gets and sets the Table. /// </summary> public string Table { get { return m_Table; } set { m_Table = value; } } /// <summary> /// Gets and sets the DiscriminatorValue. /// </summary> public string DiscriminatorValue { get { return m_DiscriminatorValue; } set { m_DiscriminatorValue = value; } } /// <summary> /// Gets and sets the Mutable. /// </summary> public bool Mutable { get { return m_Mutable; } set { m_Mutable = value; } } /// <summary> /// Gets and sets the DynamicUpdate. /// </summary> public bool DynamicUpdate { get { return m_DynamicUpdate; } set { m_DynamicUpdate = value; } } /// <summary> /// Gets and sets the DynamicInsert. /// </summary> public bool DynamicInsert { get { return m_DynamicInsert; } set { m_DynamicInsert = value; } } /// <summary> /// Gets and sets the Polymorphism. /// </summary> public ClassPolymorphismType Polymorphism { get { return m_Polymorphism; } set { m_Polymorphism = value; } } /// <summary> /// Gets and sets the SqlWhere. /// </summary> public string SqlWhere { get { return m_SqlWhere; } set { m_SqlWhere = value; } } /// <summary> /// Gets and sets the Persister. /// </summary> public System.Type Persister { get { return m_Persister; } set { m_Persister = value; } } /// <summary> /// Gets and sets the Schema. /// </summary> public string Schema { get { return m_Schema; } set { m_Schema = value; } } // /// <summary> // /// Gets and sets the Proxy. // /// </summary> // public System.Type Proxy // { // get { return m_Proxy; } // set { m_Proxy = value; } // } } } --- NEW FILE: JoinedSubclassKeyAttribute.cs --- using System; namespace NHibernate.Tool.Net2Hbm { /// <summary> /// Summary description for JoinedSubclassKeyAttribute. /// </summary> [AttributeUsage(AttributeTargets.Class)] public class JoinedSubclassKeyAttribute : Attribute { #region Member Variables private string m_Column; #endregion /// <summary> /// Class constructor. /// </summary> public JoinedSubclassKeyAttribute( string column ) { this.Column = column; } /// <summary> /// Gets and sets the Column. /// </summary> public string Column { get { return m_Column; } set { m_Column = value; } } } } --- NEW FILE: CollectionCompositeElementAttribute.cs --- using System; namespace NHibernate.Tool.Net2Hbm { /// <summary> /// Summary description for CollectionCompositeElementAttribute. /// </summary> [AttributeUsage(AttributeTargets.Property)] public class CollectionCompositeElementAttribute : Attribute { #region Member Variables private System.Type m_Type; #endregion /// <summary> /// Class constructor. /// </summary> public CollectionCompositeElementAttribute( System.Type type ) { this.Type = type; } /// <summary> /// Gets and sets the Type. /// </summary> public System.Type Type { get { return m_Type; } set { m_Type = value; } } } } --- NEW FILE: DiscriminatorAttribute.cs --- using System; namespace NHibernate.Tool.Net2Hbm { /// <summary> /// Summary description for DiscriminatorAttribute. /// </summary> [AttributeUsage(AttributeTargets.Class)] public class DiscriminatorAttribute : Attribute { #region Member Variables private string m_Column; private System.Type m_Type; private bool m_Force; #endregion /// <summary> /// Class constructor. /// </summary> public DiscriminatorAttribute( string column, System.Type type ) { m_Column = column; m_Type = type; } /// <summary> /// Class constructor. /// </summary> /// <param name="column"></param> /// <param name="force"></param> public DiscriminatorAttribute( string column, System.Type type, bool force ) : this( column, type ) { m_Force = force; } /// <summary> /// Gets and sets the Column. /// </summary> public string Column { get { return m_Column; } set { m_Column = value; } } /// <summary> /// Gets and sets the Force. /// </summary> public bool Force { get { return m_Force; } set { m_Force = value; } } /// <summary> /// Gets and sets the Type. /// </summary> public System.Type Type { get { return m_Type; } set { m_Type = value; } } } } --- NEW FILE: CollectionManyToManyAttribute.cs --- using System; namespace NHibernate.Tool.Net2Hbm { /// <summary> /// Summary description for CollectionManyToManyAttribute. /// </summary> [AttributeUsage(AttributeTargets.Property)] public class CollectionManyToManyAttribute : Attribute { #region Member Variables private string m_Column; private OuterJoinType m_OuterJoin; private System.Type m_Type; #endregion /// <summary> /// Class constructor. /// </summary> public CollectionManyToManyAttribute( string column, System.Type type ) { this.Column = column; this.Type = type; } /// <summary> /// Gets and sets the Column. /// </summary> public string Column { get { return m_Column; } set { m_Column = value; } } /// <summary> /// Gets and sets the OuterJoin. /// </summary> public OuterJoinType OuterJoin { get { return m_OuterJoin; } set { m_OuterJoin = value; } } /// <summary> /// Gets and sets the Type. /// </summary> public System.Type Type { get { return m_Type; } set { m_Type = value; } } } } --- NEW FILE: MapGenerator.cs --- using System; using System.Collections; using System.Reflection; using System.IO; using System.Xml; using System.Xml.Serialization; using System.Text.RegularExpressions; namespace NHibernate.Tool.Net2Hbm { /// <summary> /// Summary description for MapGenerator. /// </summary> public sealed class MapGenerator { #region Member Variables private SortedList m_Types; private Regex m_AssemblyQualifiedNameRegex; private const string AssemblyQualifiedPattern = @"^(?<type>[\w\.\[\]]+),\s(?<assembly>[\w\.]+),\sVersion=(?<version>[\d\.]+),\sCulture=(?<culture>[\w\.]+),\sPublicKeyToken=(?<key>[\w]+)$"; #endregion /// <summary> /// Class constructor. /// </summary> public MapGenerator() { m_Types = new SortedList(); m_AssemblyQualifiedNameRegex = new Regex( MapGenerator.AssemblyQualifiedPattern, RegexOptions.None ); } /// <summary> /// Adds the assembly's types to the generator. /// </summary> /// <param name="assembly"></param> public void AddAssembly( string assembly ) { this.AddAssembly( Assembly.Load( assembly ) ); } /// <summary> /// Adds the assembly's types to the generator. /// </summary> /// <param name="assembly"></param> public void AddAssembly( Assembly assembly ) { System.Type[] types = assembly.GetTypes(); foreach( System.Type type in types ) { if( type.IsClass ) { AddClass( type ); } } } /// <summary> /// Adds the class type to the generator. /// </summary> /// <param name="type"></param> public void AddClass( System.Type type ) { if( type.IsClass ) { if( type.IsDefined( typeof(ClassAttribute), true ) || type.IsDefined( typeof(JoinedSubclassAttribute), true ) || type.IsDefined( typeof(SubclassAttribute), true ) ) { m_Types.Add( new TypeKey( type ), type ); } } else { throw new ArgumentException( "Invalid type. Only class types can be added to the generator.", "type" ); } } /// <summary> /// Generates the mapping. /// </summary> /// <param name="map"></param> public void Generate( Stream map ) { // //create the stream we will use to write the xml into // XmlWriter writer = new XmlTextWriter( map, System.Text.Encoding.UTF8 ); writer.WriteComment( String.Format( "Generated by Net2Hbm on {0}.", DateTime.Now ) ); writer.WriteStartElement("hibernate-mapping", "urn:nhibernate-mapping-2.0" ); // //write each type into the stream // TypeNodeCollection nodes = BuildTypeDependencyTree( m_Types ); foreach( TypeNode node in nodes ) { WriteTypeNode( writer, node ); } writer.WriteEndElement(); //</hibernate-mapping> writer.Flush(); } /// <summary> /// Writes the type's map information into the xml writer. /// </summary> /// <param name="writer"></param> /// <param name="node"></param> private void WriteTypeNode( XmlWriter writer, TypeNode node ) { bool looking = true; System.Type type = node.Type; while( looking ) { if( Attribute.IsDefined( type, typeof(ClassAttribute), false ) ) { writer.WriteComment( GetShortTypeName( node.Type ) ); WriteClass( writer, node, type ); looking = false; } else if( Attribute.IsDefined( type, typeof(JoinedSubclassAttribute), false ) ) { writer.WriteComment( GetShortTypeName( node.Type ) ); WriteJoinedSubclass( writer, node, type ); looking = false; } else if( Attribute.IsDefined( type, typeof(SubclassAttribute), false ) ) { writer.WriteComment( GetShortTypeName( node.Type ) ); WriteSubclass( writer, node, type ); looking = false; } else { type = type.BaseType; looking = true; } } } /// <summary> /// Writes the collection. /// </summary> /// <param name="writer"></param> /// <param name="type"></param> private void WriteCollections( XmlWriter writer, System.Type type, bool declaredOnly ) { PropertyInfo[] listProps = FindAttributedProperties( typeof(ListAttribute), type, declaredOnly ); foreach( PropertyInfo listProp in listProps ) { WriteList( writer, listProp ); } PropertyInfo[] setProps = FindAttributedProperties( typeof(SetAttribute), type, declaredOnly ); foreach( PropertyInfo setProp in setProps ) { WriteSet( writer, setProp ); } } /// <summary> /// Writes the list. /// </summary> /// <param name="writer"></param> /// <param name="parentNode"></param> private void WriteList( XmlWriter writer, PropertyInfo property ) { ListAttribute attribute = (ListAttribute)Attribute.GetCustomAttribute( property, typeof(ListAttribute) ); writer.WriteStartElement( "list" ); writer.WriteAttributeString( "name", property.Name ); writer.WriteAttributeString( "table", attribute.Table ); if( attribute.IsLazy ) writer.WriteAttributeString( "lazy", "true" ); if( attribute.IsInverse ) writer.WriteAttributeString( "inverse", "true" ); WriteCollectionKey( writer, property ); WriteCollectionIndex( writer, property ); WriteCollectionCompositeElement( writer, property ); WriteCollectionManyToMany( writer, property ); writer.WriteEndElement(); //<list> } /// <summary> /// Writes the list. /// </summary> /// <param name="writer"></param> /// <param name="parentNode"></param> private void WriteSet( XmlWriter writer, PropertyInfo property ) { SetAttribute attribute = (SetAttribute)Attribute.GetCustomAttribute( property, typeof(SetAttribute) ); writer.WriteStartElement( "set" ); writer.WriteAttributeString( "name", property.Name ); writer.WriteAttributeString( "table", attribute.Table ); if( attribute.IsLazy ) writer.WriteAttributeString( "lazy", "true" ); WriteCollectionKey( writer, property ); WriteCollectionCompositeElement( writer, property ); writer.WriteEndElement(); //<list> } /// <summary> /// Writes the collection key. /// </summary> /// <param name="writer"></param> /// <param name="property"></param> private void WriteCollectionKey( XmlWriter writer, PropertyInfo property ) { CollectionKeyAttribute attribute = (CollectionKeyAttribute)Attribute.GetCustomAttribute( property, typeof(CollectionKeyAttribute) ); if( attribute != null ) { writer.WriteStartElement( "key" ); writer.WriteAttributeString( "column", attribute.Column ); writer.WriteEndElement(); //</key> } } /// <summary> /// Writes the collection index. /// </summary> /// <param name="writer"></param> /// <param name="type"></param> private void WriteDiscriminator( XmlWriter writer, System.Type type ) { DiscriminatorAttribute attribute = (DiscriminatorAttribute)Attribute.GetCustomAttribute( type, typeof(DiscriminatorAttribute) ); if( attribute != null ) { writer.WriteStartElement( "discriminator" ); writer.WriteAttributeString( "column", attribute.Column ); writer.WriteAttributeString( "type", GetShortTypeName( attribute.Type ) ); if( attribute.Force ) writer.WriteAttributeString( "force", "true" ); writer.WriteEndElement(); //</discriminator> } } /// <summary> /// Writes the collection index. /// </summary> /// <param name="writer"></param> /// <param name="property"></param> private void WriteCollectionIndex( XmlWriter writer, PropertyInfo property ) { CollectionIndexAttribute attribute = (CollectionIndexAttribute)Attribute.GetCustomAttribute( property, typeof(CollectionIndexAttribute) ); if( attribute != null ) { writer.WriteStartElement( "index" ); writer.WriteAttributeString( "column", attribute.Column ); writer.WriteEndElement(); //</index> } } /// <summary> /// Writes the collection composite element. /// </summary> /// <param name="writer"></param> /// <param name="property"></param> private void WriteCollectionCompositeElement( XmlWriter writer, PropertyInfo property ) { CollectionCompositeElementAttribute attribute = (CollectionCompositeElementAttribute)Attribute.GetCustomAttribute( property, typeof(CollectionCompositeElementAttribute) ); if( attribute != null ) { writer.WriteStartElement( "composite-element" ); writer.WriteAttributeString( "class", GetShortTypeName( attribute.Type ) ); WriteProperties( writer, attribute.Type, false ); writer.WriteEndElement(); //</composite-element> } } /// <summary> /// Writes the collection many to many. /// </summary> /// <param name="writer"></param> /// <param name="property"></param> private void WriteCollectionManyToMany( XmlWriter writer, PropertyInfo property ) { CollectionManyToManyAttribute attribute = (CollectionManyToManyAttribute)Attribute.GetCustomAttribute( property, typeof(CollectionManyToManyAttribute) ); if( attribute != null ) { writer.WriteStartElement( "many-to-many" ); writer.WriteAttributeString( "column", attribute.Column ); writer.WriteAttributeString( "class", GetShortTypeName( attribute.Type ) ); writer.WriteEndElement(); //</many-to-many> } } /// <summary> /// Writes the subclass. /// </summary> private void WriteSubclass( XmlWriter writer, TypeNode node, System.Type type ) { SubclassAttribute attribute = (SubclassAttribute)Attribute.GetCustomAttribute( type, typeof(SubclassAttribute), true ); writer.WriteStartElement( "subclass" ); writer.WriteAttributeString( "name", GetShortTypeName( node.Type ) ); if( attribute.DiscriminatorValue != null ) writer.WriteAttributeString( "discriminator-value", attribute.DiscriminatorValue ); if( attribute.DynamicInsert ) writer.WriteAttributeString( "dynamic-insert", "true" ); if( attribute.DynamicUpdate ) writer.WriteAttributeString( "dynamic-update", "true" ); WriteProperties( writer, type, true ); WriteCollections( writer, type, true ); WriteAssociations( writer, type, true ); foreach( TypeNode childNode in node.Nodes ) { WriteTypeNode( writer, childNode ); } writer.WriteEndElement(); //</subclass> } /// <summary> /// Writes the class. /// </summary> private void WriteClass( XmlWriter writer, TypeNode node, System.Type type ) { ClassAttribute attribute = (ClassAttribute)Attribute.GetCustomAttribute( type, typeof(ClassAttribute), true ); writer.WriteStartElement( "class" ); writer.WriteAttributeString( "name", GetShortTypeName( node.Type ) ); writer.WriteAttributeString( "table", attribute.Table ); if( attribute.DiscriminatorValue != null ) writer.WriteAttributeString( "discriminator-value", attribute.DiscriminatorValue ); if( attribute.SqlWhere != null ) writer.WriteAttributeString( "where", attribute.SqlWhere ); WriteId( writer, node.Type ); WriteDiscriminator( writer, type ); WriteVersion( writer, type ); WriteProperties( writer, type, false ); WriteCollections( writer, type, false ); WriteAssociations( writer, type, false ); foreach( TypeNode childNode in node.Nodes ) { WriteTypeNode( writer, childNode ); } writer.WriteEndElement(); //</class> } /// <summary> /// Writes the property. /// </summary> /// <param name="writer"></param> /// <param name="property"></param> private void WriteProperty( XmlWriter writer, PropertyInfo property ) { PropertyAttribute attribute = (PropertyAttribute)Attribute.GetCustomAttribute( property, typeof(PropertyAttribute) ); writer.WriteStartElement( "property" ); writer.WriteAttributeString( "name", property.Name ); writer.WriteAttributeString( "column", attribute.Column == null ? property.Name : attribute.Column ); string typeName = null; if( attribute.Type != null ) typeName = GetShortTypeName( attribute.Type ); else typeName = GetShortTypeName( property.PropertyType ); if( attribute.Size > 0 ) { writer.WriteAttributeString( "type", String.Format( "{0}({1})", typeName, attribute.Size ) ); } else { writer.WriteAttributeString( "type", typeName ); } if( !attribute.Insert ) writer.WriteAttributeString( "insert", "false" ); if( !attribute.Update ) writer.WriteAttributeString( "update", "false" ); //if( attribute.Size > 0 ) // writer.WriteAttributeString( "length", attribute.Size.ToString() ); writer.WriteEndElement(); //</property> } /// <summary> /// Writers the properties. /// </summary> /// <param name="writer"></param> /// <param name="parentNode"></param> private void WriteProperties( XmlWriter writer, System.Type type, bool declaredOnly ) { PropertyInfo[] properties = FindAttributedProperties( typeof(PropertyAttribute), type, declaredOnly ); foreach( PropertyInfo property in properties ) { WriteProperty( writer, property ); } } /// <summary> /// Writes the assoications. /// </summary> /// <param name="writer"></param> /// <param name="type"></param> private void WriteAssociations( XmlWriter writer, System.Type type, bool declaredOnly ) { PropertyInfo[] properties = FindAttributedProperties( typeof(ManyToOneAttribute), type, declaredOnly ); foreach( PropertyInfo property in properties ) { WriteManyToOne( writer, property ); } } /// <summary> /// Writes the many to one association. /// </summary> /// <param name="writer"></param> /// <param name="property"></param> private void WriteManyToOne( XmlWriter writer, PropertyInfo property ) { ManyToOneAttribute attribute = (ManyToOneAttribute)Attribute.GetCustomAttribute( property, typeof(ManyToOneAttribute) ); if( attribute.Inheritable || ( !attribute.Inheritable && ( property.DeclaringType == property.ReflectedType ) ) ) { writer.WriteStartElement( "many-to-one" ); writer.WriteAttributeString( "name", property.Name ); writer.WriteAttributeString( "column", attribute.Column == null ? property.Name : attribute.Column ); string typeName = null; if( attribute.Type != null ) typeName = GetShortTypeName( attribute.Type ); else typeName = GetShortTypeName( property.PropertyType ); writer.WriteAttributeString( "class", typeName ); if( attribute.Cascade != CascadeType.None ) writer.WriteAttributeString( "cascade", GetXmlEnumValue( typeof(CascadeType), attribute.Cascade ) ); if( attribute.OuterJoin != OuterJoinType.Auto ) writer.WriteAttributeString( "outer-join", GetXmlEnumValue( typeof(OuterJoinType), attribute.OuterJoin ) ); if( !attribute.Insert ) writer.WriteAttributeString( "insert", "false" ); if( !attribute.Update ) writer.WriteAttributeString( "update", "false" ); writer.WriteEndElement(); //</many-to-one> } } /// <summary> /// Writes the version. /// </summary> /// <param name="writer"></param> /// <param name="parentNode"></param> private void WriteVersion( XmlWriter writer, System.Type type ) { PropertyInfo property = FindAttributedProperty( typeof(VersionAttribute), type ); if( property != null ) { VersionAttribute attribute = (VersionAttribute)Attribute.GetCustomAttribute( property, typeof(VersionAttribute), false ); writer.WriteStartElement( "version" ); writer.WriteAttributeString( "name", property.Name ); writer.WriteAttributeString( "column", attribute.Column ); writer.WriteAttributeString( "type", GetShortTypeName( property.PropertyType ) ); writer.WriteEndElement(); //</version> } } /// <summary> /// Writes the id. /// </summary> /// <param name="writer"></param> /// <param name="parentNode"></param> private void WriteId( XmlWriter writer, System.Type type ) { PropertyInfo property = FindAttributedProperty( typeof(IdAttribute), type ); if( property == null ) throw new Exception( "Missing required IdAttribute." ); IdAttribute attribute = (IdAttribute)Attribute.GetCustomAttribute( property, typeof(IdAttribute), false ); writer.WriteStartElement( "id" ); writer.WriteAttributeString( "name", property.Name ); writer.WriteAttributeString( "type", GetShortTypeName( property.PropertyType ) ); writer.WriteAttributeString( "column", attribute.Column ); if( attribute.UnsavedValueType == UnsavedValueType.Specified ) writer.WriteAttributeString( "unsaved-value", attribute.UnsavedValue ); else writer.WriteAttributeString( "unsaved-value", GetXmlEnumValue( typeof(UnsavedValueType), attribute.UnsavedValueType ) ); writer.WriteStartElement("generator"); writer.WriteAttributeString( "class", GetShortTypeName( attribute.Generator ) ); writer.WriteEndElement(); //</generator> writer.WriteEndElement(); //</id> } /// <summary> /// Writes the joined subclass. /// </summary> private void WriteJoinedSubclass( XmlWriter writer, TypeNode node, System.Type type ) { JoinedSubclassAttribute attribute = (JoinedSubclassAttribute)Attribute.GetCustomAttribute( type, typeof(JoinedSubclassAttribute), true ); writer.WriteStartElement( "joined-subclass" ); writer.WriteAttributeString( "name", GetShortTypeName( node.Type ) ); writer.WriteAttributeString( "table", attribute.Table ); WriteJoinedSubclassKey( writer, type ); WriteProperties( writer, type, true ); WriteCollections( writer, type, true ); WriteAssociations( writer, type, true ); foreach( TypeNode childNode in node.Nodes ) { WriteTypeNode( writer, childNode ); } writer.WriteEndElement(); //</joined-subclass> } /// <summary> /// Writes the joined subclass key. /// </summary> /// <param name="writer"></param> /// <param name="parentNode"></param> private void WriteJoinedSubclassKey( XmlWriter writer, System.Type type ) { JoinedSubclassKeyAttribute attribute = (JoinedSubclassKeyAttribute)Attribute.GetCustomAttribute( type, typeof(JoinedSubclassKeyAttribute), false ); writer.WriteStartElement( "key" ); writer.WriteAttributeString( "column", attribute.Column ); writer.WriteEndElement(); //</key> } /// <summary> /// Constructs an array of TypeNodes. /// </summary> /// <param name="list"></param> /// <returns></returns> private TypeNodeCollection BuildTypeDependencyTree( SortedList list ) { TypeNodeCollection nodes = new TypeNodeCollection(); Hashtable lookup = new Hashtable(); foreach( DictionaryEntry entry in list ) { TypeKey key = (TypeKey)entry.Key; TypeNode node = new TypeNode( key.Type ); lookup.Add( node.Type, node ); if( key.ExtendsType != null ) { TypeNode extendNode = (TypeNode)lookup[key.ExtendsType]; extendNode.Nodes.Add( node ); } else { nodes.Add( node ); } } return nodes; } /// <summary> /// Searches the members of the class for any member with the attribute defined. /// </summary> /// <param name="attribute"></param> /// <param name="type"></param> /// <returns></returns> private PropertyInfo FindAttributedProperty( System.Type attrType, System.Type classType ) { System.Type type = classType; while( ( type == classType ) || ( ( type != null ) && ( !type.IsDefined( typeof(ClassAttribute), false ) ) && ( !type.IsDefined( typeof(SubclassAttribute), false ) ) && ( !type.IsDefined( typeof(JoinedSubclassAttribute), false ) ) ) ) { PropertyInfo[] properties = type.GetProperties( BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic ); foreach( PropertyInfo property in properties ) { if( property.IsDefined( attrType, false ) ) { return property; } } type = type.BaseType; } return null; } /// <summary> /// Searches the members of the class for any member with the attribute defined. /// </summary> /// <param name="attrType"></param> /// <param name="classType"></param> /// <returns></returns> private PropertyInfo[] FindAttributedProperties( System.Type attrType, System.Type classType, bool declaredOnly ) { ArrayList list = new ArrayList(); BindingFlags bindings = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; /*if( declaredOnly )*/ bindings = bindings | BindingFlags.DeclaredOnly; System.Type type = classType; while( ( type == classType ) || ( ( type != null ) && ( !type.IsDefined( typeof(ClassAttribute), false ) ) && ( !type.IsDefined( typeof(SubclassAttribute), false ) ) && ( !type.IsDefined( typeof(JoinedSubclassAttribute), false ) ) ) ) { PropertyInfo[] properties = type.GetProperties( bindings ); foreach( PropertyInfo property in properties ) { if( property.IsDefined( attrType, false ) ) { list.Add( property ); } } type = type.BaseType; } PropertyInfo[] array = new PropertyInfo[list.Count]; list.CopyTo( array ); return array; } /// <summary> /// Converts the full name into a short name. /// </summary> /// <param name="type"></param> /// <returns></returns> private string GetShortTypeName( System.Type type ) { Match name = m_AssemblyQualifiedNameRegex.Match( type.AssemblyQualifiedName ); string typeName = name.Groups["type"].Value; string assemblyName = name.Groups["assembly"].Value; if( assemblyName == "mscorlib" && typeName.StartsWith( "System." ) && typeName.IndexOf(".") == typeName.LastIndexOf(".") ) { return typeName.Substring( typeName.LastIndexOf(".") + 1 ); } else { return String.Format( "{0}, {1}",typeName, assemblyName ); } } /// <summary> /// Gets the xml enum value from the associated attributed enum. /// </summary> /// <param name="enumType"></param> /// <param name="value"></param> /// <returns></returns> private string GetXmlEnumValue( System.Type enumType, object @value ) { FieldInfo[] fields = enumType.GetFields(); foreach( FieldInfo field in fields ) { if( field.Name == Enum.GetName( enumType, @value ) ) { XmlEnumAttribute attribute = (XmlEnumAttribute)Attribute.GetCustomAttribute( field, typeof(XmlEnumAttribute), false ); if( attribute != null ) { return attribute.Name; } else { throw new ApplicationException( String.Format( "{0} is missing XmlEnumAttribute on {1} value.", enumType, @value ) ); } } } throw new MissingFieldException( enumType.ToString(), @value.ToString() ); } } } --- NEW FILE: VersionAttribute.cs --- using System; namespace NHibernate.Tool.Net2Hbm { /// <summary> /// Summary description for VersionAttribute. /// </summary> [AttributeUsage(AttributeTargets.Property)] public class VersionAttribute : Attribute { #region Member Variables private string m_Column; #endregion /// <summary> /// Class constructor. /// </summary> public VersionAttribute( string column ) { this.Column = column; } /// <summary> /// Gets and sets the Column. /// </summary> public string Column { get { return m_Column; } set { m_Column = value; } } } } --- NEW FILE: SubclassAttribute.cs --- using System; namespace NHibernate.Tool.Net2Hbm { /// <summary> /// Summary description for SubclassAttribute. /// </summary> [AttributeUsage(AttributeTargets.Class)] public class SubclassAttribute : Attribute { #region Member Variables private System.Type m_Extends; private string m_DiscriminatorValue; // private System.Type m_Proxy; private bool m_DynamicUpdate; private bool m_DynamicInsert; #endregion /// <summary> /// Class constructor. /// </summary> public SubclassAttribute() { } /// <summary> /// Class constructor. /// </summary> ... [truncated message content] |
From: Michael D. <mik...@us...> - 2004-12-30 16:47:45
|
Update of /cvsroot/nhibernate/NHibernateContrib/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24543 Added Files: Commons.dll Commons.license.txt Commons.xml NVelocity.dll NVelocity.license.txt NVelocity.xml Log Message: Moved libraries from nhibernate to NHibernateContrib --- NEW FILE: Commons.license.txt --- /* * ==================================================================== * * The Apache Software License, Version 1.1 * * Copyright (c) 2002 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowledgement: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgement may appear in the software itself, * if and wherever such third-party acknowledgements normally appear. * * 4. The names "The Jakarta Project", "Velocity", and "Apache Software * Foundation" must not be used to endorse or promote products derived * from this software without prior written permission. For written * permission, please contact ap...@ap.... * * 5. Products derived from this software may not be called "Apache", * "Velocity" nor may "Apache" appear in their names without prior * written permission of the Apache Group. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * <http://www.apache.org/>. * */ --- NEW FILE: NVelocity.xml --- <?xml version="1.0"?> <doc> <assembly> <name>NVelocity</name> </assembly> <members> <member name="T:NVelocity.App.Events.EventCartridge"> <summary> 'Package' of event handlers... * </summary> <author> <a href="mailto:ge...@op...">Geir Magnusson Jr.</a> </author> <author> <a href="mailto:j_a...@ya...">Jose Alberto Fernandez</a> </author> <version> $Id: NVelocity.xml,v 1.1 2004/12/30 16:47:30 mikedoerfler Exp $ </version> </member> <member name="T:NVelocity.App.Events.ReferenceInsertionEventHandler"> [...6744 lines suppressed...] <summary> The AST node structure is merged with the context to produce the final output. * Throws IOException if failure is due to a file related issue, and Exception otherwise * </summary> <param name="context">Conext with data elements accessed by template </param> <param name="writer">output writer for rendered template @throws ResourceNotFoundException if template not found from any available source. @throws ParseErrorException if template cannot be parsed due to syntax (or other) error. @throws Exception anything else. </param> </member> </members> </doc> --- NEW FILE: Commons.dll --- (This appears to be a binary file; contents omitted.) --- NEW FILE: Commons.xml --- <?xml version="1.0"?> <doc> <assembly> <name>Commons</name> </assembly> <members> <member name="T:Commons.Collections.CollectionsUtil"> <summary> Static utility methods for collections </summary> </member> <!-- Badly formed XML comment ignored for member "T:Commons.Collections.ExtendedProperties" --> <member name="F:Commons.Collections.ExtendedProperties.defaults"> <summary> Default configurations repository. </summary> </member> <member name="F:Commons.Collections.ExtendedProperties.file"> <summary> The file connected to this repository (holding comments and such). * @serial </summary> </member> <member name="F:Commons.Collections.ExtendedProperties.basePath"> <summary> Base path of the configuration file used to create this ExtendedProperties object. </summary> </member> <member name="F:Commons.Collections.ExtendedProperties.fileSeparator"> <summary> File separator. </summary> </member> <member name="F:Commons.Collections.ExtendedProperties.isInitialized"> <summary> Has this configuration been intialized. </summary> </member> <member name="F:Commons.Collections.ExtendedProperties.include"> <summary> This is the name of the property that can point to other properties file for including other properties files. </summary> </member> <member name="F:Commons.Collections.ExtendedProperties.keysAsListed"> <summary> These are the keys in the order they listed in the configuration file. This is useful when you wish to perform operations with configuration information in a particular order. </summary> </member> <member name="M:Commons.Collections.ExtendedProperties.#ctor"> <summary> Creates an empty extended properties object. </summary> </member> <member name="M:Commons.Collections.ExtendedProperties.#ctor(System.String)"> <summary> Creates and loads the extended properties from the specified file. * </summary> <param name="file">A String. </param> <exception cref="!:">IOException. </exception> </member> <member name="M:Commons.Collections.ExtendedProperties.#ctor(System.String,System.String)"> <summary> Creates and loads the extended properties from the specified file. * </summary> <param name="file">A String. </param> <exception cref="!:">IOException. </exception> </member> <member name="M:Commons.Collections.ExtendedProperties.Init(Commons.Collections.ExtendedProperties)"> <summary> Private initializer method that sets up the generic resources. * </summary> <exception cref="!:">IOException, if there was an I/O problem. </exception> </member> <member name="M:Commons.Collections.ExtendedProperties.IsInitialized"> <summary> Indicate to client code whether property resources have been initialized or not. </summary> </member> <member name="M:Commons.Collections.ExtendedProperties.Load(System.IO.Stream)"> <summary> Load the properties from the given input stream. * </summary> <param name="input">An InputStream. </param> <exception cref="!:">IOException. </exception> </member> <member name="M:Commons.Collections.ExtendedProperties.Load(System.IO.Stream,System.String)"> <summary> Load the properties from the given input stream and using the specified encoding. * </summary> <param name="input">An InputStream. </param> <param name="enc">An encoding. </param> <exception cref="!:">IOException. </exception> </member> <member name="M:Commons.Collections.ExtendedProperties.GetProperty(System.String)"> <summary> Gets a property from the configuration. * </summary> <param name="key">property to retrieve </param> <returns>value as object. Will return user value if exists, if not then default value if exists, otherwise null </returns> </member> <member name="M:Commons.Collections.ExtendedProperties.AddProperty(System.String,System.Object)"> <summary> Add a property to the configuration. If it already exists then the value stated here will be added to the configuration entry. For example, if * resource.loader = file * is already present in the configuration and you * addProperty("resource.loader", "classpath") * Then you will end up with a Vector like the following: * ["file", "classpath"] * </summary> <param name="String">key </param> <param name="String">value </param> </member> <member name="M:Commons.Collections.ExtendedProperties.AddPropertyDirect(System.String,System.Object)"> <summary> Adds a key/value pair to the map. This routine does no magic morphing. It ensures the keylist is maintained * </summary> <param name="key">key to use for mapping </param> <param name="obj">object to store </param> </member> <member name="M:Commons.Collections.ExtendedProperties.AddStringProperty(System.String,System.String)"> <summary> Sets a string property w/o checking for commas - used internally when a property has been broken up into strings that could contain escaped commas to prevent the inadvertant vectorization. Thanks to Leon Messerschmidt for this one. </summary> </member> <member name="M:Commons.Collections.ExtendedProperties.SetProperty(System.String,System.Object)"> <summary> Set a property, this will replace any previously set values. Set values is implicitly a call to clearProperty(key), addProperty(key,value). </summary> <param name="String">key </param> <param name="String">value </param> </member> <member name="M:Commons.Collections.ExtendedProperties.Save(System.IO.TextWriter,System.String)"> <summary> Save the properties to the given outputstream. </summary> <param name="output">An OutputStream. </param> <param name="header">A String. </param> <exception cref="!:">IOException. </exception> </member> <member name="M:Commons.Collections.ExtendedProperties.Combine(Commons.Collections.ExtendedProperties)"> <summary> Combines an existing Hashtable with this Hashtable. * Warning: It will overwrite previous entries without warning. * </summary> <param name="">ExtendedProperties </param> </member> <member name="M:Commons.Collections.ExtendedProperties.ClearProperty(System.String)"> <summary> Clear a property in the configuration. * </summary> <param name="String">key to remove along with corresponding value. </param> </member> <member name="M:Commons.Collections.ExtendedProperties.GetKeys(System.String)"> <summary> Get the list of the keys contained in the configuration repository that match the specified prefix. * </summary> <param name="prefix">The prefix to test against. </param> <returns>An Iterator of keys that match the prefix. </returns> </member> <member name="M:Commons.Collections.ExtendedProperties.Subset(System.String)"> <summary> Create an ExtendedProperties object that is a subset of this one. Take into account duplicate keys by using the setProperty() in ExtendedProperties. * </summary> <param name="String">prefix </param> </member> <member name="M:Commons.Collections.ExtendedProperties.ToString"> <summary> Display the configuration for debugging purposes. </summary> </member> <member name="M:Commons.Collections.ExtendedProperties.GetString(System.String)"> <summary> Get a string associated with the given configuration key. * </summary> <param name="key">The configuration key. </param> <returns>The associated string. </returns> <exception cref="!:">ClassCastException is thrown if the key maps to an object that is not a String. </exception> </member> <member name="M:Commons.Collections.ExtendedProperties.GetString(System.String,System.String)"> <summary> Get a string associated with the given configuration key. * </summary> <param name="key">The configuration key. </param> <param name="defaultValue">The default value. </param> <returns>The associated string if key is found, default value otherwise. </returns> <exception cref="!:">ClassCastException is thrown if the key maps to an object that is not a String. </exception> </member> <member name="M:Commons.Collections.ExtendedProperties.GetProperties(System.String)"> <summary> Get a list of properties associated with the given configuration key. * </summary> <param name="key">The configuration key. </param> <returns>The associated properties if key is found. </returns> <exception cref="!:">ClassCastException is thrown if the key maps to an object that is not a String/Vector. </exception> <exception cref="!:">IllegalArgumentException if one of the tokens is malformed (does not contain an equals sign). </exception> </member> <member name="M:Commons.Collections.ExtendedProperties.GetProperties(System.String,System.Collections.Hashtable)"> <summary> Get a list of properties associated with the given configuration key. * </summary> <param name="key">The configuration key. </param> <returns>The associated properties if key is found. </returns> <exception cref="!:">ClassCastException is thrown if the key maps to an object that is not a String/Vector. </exception> <exception cref="!:">IllegalArgumentException if one of the tokens is malformed (does not contain an equals sign). </exception> </member> <member name="M:Commons.Collections.ExtendedProperties.GetStringArray(System.String)"> <summary> Get an array of strings associated with the given configuration key. * </summary> <param name="key">The configuration key. </param> <returns>The associated string array if key is found. </returns> <exception cref="!:">ClassCastException is thrown if the key maps to an object that is not a String/Vector. </exception> </member> <member name="M:Commons.Collections.ExtendedProperties.GetVector(System.String)"> <summary> Get a Vector of strings associated with the given configuration key. * </summary> <param name="key">The configuration key. </param> <returns>The associated Vector. </returns> <exception cref="!:">ClassCastException is thrown if the key maps to an object that is not a Vector. </exception> </member> <member name="M:Commons.Collections.ExtendedProperties.GetVector(System.String,System.Collections.ArrayList)"> <summary> Get a Vector of strings associated with the given configuration key. * </summary> <param name="key">The configuration key. </param> <param name="defaultValue">The default value. </param> <returns>The associated Vector. </returns> <exception cref="!:">ClassCastException is thrown if the key maps to an object that is not a Vector. </exception> </member> <member name="M:Commons.Collections.ExtendedProperties.GetBoolean(System.String)"> <summary> Get a boolean associated with the given configuration key. * </summary> <param name="key">The configuration key. </param> <returns>The associated boolean. </returns> <exception cref="!:">NoSuchElementException is thrown if the key doesn't map to an existing object. </exception> <exception cref="!:">ClassCastException is thrown if the key maps to an object that is not a Boolean. </exception> </member> <member name="M:Commons.Collections.ExtendedProperties.GetBoolean(System.String,System.Boolean)"> <summary> Get a boolean associated with the given configuration key. * </summary> <param name="key">The configuration key. </param> <param name="defaultValue">The default value. </param> <returns>The associated boolean if key is found and has valid format, default value otherwise. </returns> <exception cref="!:">ClassCastException is thrown if the key maps to an object that is not a Boolean. </exception> </member> <member name="M:Commons.Collections.ExtendedProperties.TestBoolean(System.String)"> <summary> Test whether the string represent by value maps to a boolean value or not. We will allow <code>true</code>, <code>on</code>, and <code>yes</code> for a <code>true</code> boolean value, and <code>false</code>, <code>off</code>, and <code>no</code> for <code>false</code> boolean values. Case of value to test for boolean status is ignored. * </summary> <param name="String">The value to test for boolean state. </param> <returns><code>true</code> or <code>false</code> if the supplied text maps to a boolean value, or <code>null</code> otherwise. </returns> </member> <member name="M:Commons.Collections.ExtendedProperties.GetByte(System.String)"> <summary> Get a byte associated with the given configuration key. * </summary> <param name="key">The configuration key. </param> <returns>The associated byte. </returns> <exception cref="!:">NoSuchElementException is thrown if the key doesn't map to an existing object. </exception> <exception cref="!:">ClassCastException is thrown if the key maps to an object that is not a Byte. </exception> <exception cref="!:">NumberFormatException is thrown if the value mapped by the key has not a valid number format. </exception> </member> <member name="M:Commons.Collections.ExtendedProperties.GetByte(System.String,System.SByte)"> <summary> Get a byte associated with the given configuration key. * </summary> <param name="key">The configuration key. </param> <param name="defaultValue">The default value. </param> <returns>The associated byte. </returns> <exception cref="!:">ClassCastException is thrown if the key maps to an object that is not a Byte. </exception> <exception cref="!:">NumberFormatException is thrown if the value mapped by the key has not a valid number format. </exception> </member> <member name="M:Commons.Collections.ExtendedProperties.GetByte(System.String,System.Byte)"> <summary> Get a byte associated with the given configuration key. * </summary> <param name="key">The configuration key. </param> <param name="defaultValue">The default value. </param> <returns>The associated byte if key is found and has valid format, default value otherwise. </returns> <exception cref="!:">ClassCastException is thrown if the key maps to an object that is not a Byte. </exception> <exception cref="!:">NumberFormatException is thrown if the value mapped by the key has not a valid number format. </exception> </member> <member name="M:Commons.Collections.ExtendedProperties.GetShort(System.String)"> <summary> Get a short associated with the given configuration key. * </summary> <param name="key">The configuration key. </param> <returns>The associated short. </returns> <exception cref="!:">NoSuchElementException is thrown if the key doesn't map to an existing object. </exception> <exception cref="!:">ClassCastException is thrown if the key maps to an object that is not a Short. </exception> <exception cref="!:">NumberFormatException is thrown if the value mapped by the key has not a valid number format. </exception> </member> <member name="M:Commons.Collections.ExtendedProperties.GetShort(System.String,System.Int16)"> <summary> Get a short associated with the given configuration key. * </summary> <param name="key">The configuration key. </param> <param name="defaultValue">The default value. </param> <returns>The associated short if key is found and has valid format, default value otherwise. </returns> <exception cref="!:">ClassCastException is thrown if the key maps to an object that is not a Short. </exception> <exception cref="!:">NumberFormatException is thrown if the value mapped by the key has not a valid number format. </exception> </member> <member name="M:Commons.Collections.ExtendedProperties.GetInt(System.String)"> <summary> The purpose of this method is to get the configuration resource with the given name as an integer. * </summary> <param name="name">The resource name. </param> <returns>The value of the resource as an integer. </returns> </member> <member name="M:Commons.Collections.ExtendedProperties.GetInt(System.String,System.Int32)"> <summary> The purpose of this method is to get the configuration resource with the given name as an integer, or a default value. * </summary> <param name="name">The resource name </param> <param name="def">The default value of the resource. </param> <returns>The value of the resource as an integer. </returns> </member> <member name="M:Commons.Collections.ExtendedProperties.GetInteger(System.String)"> <summary> Get a int associated with the given configuration key. * </summary> <param name="key">The configuration key. </param> <returns>The associated int. </returns> <exception cref="!:">NoSuchElementException is thrown if the key doesn't map to an existing object. </exception> <exception cref="!:">ClassCastException is thrown if the key maps to an object that is not a Integer. </exception> <exception cref="!:">NumberFormatException is thrown if the value mapped by the key has not a valid number format. </exception> </member> <member name="M:Commons.Collections.ExtendedProperties.GetInteger(System.String,System.Int32)"> <summary> Get a int associated with the given configuration key. * </summary> <param name="key">The configuration key. </param> <param name="defaultValue">The default value. </param> <returns>The associated int if key is found and has valid format, default value otherwise. </returns> <exception cref="!:">ClassCastException is thrown if the key maps to an object that is not a Integer. </exception> <exception cref="!:">NumberFormatException is thrown if the value mapped by the key has not a valid number format. </exception> </member> <member name="M:Commons.Collections.ExtendedProperties.GetLong(System.String)"> <summary> Get a long associated with the given configuration key. * </summary> <param name="key">The configuration key. </param> <returns>The associated long. </returns> <exception cref="!:">NoSuchElementException is thrown if the key doesn't map to an existing object. </exception> <exception cref="!:">ClassCastException is thrown if the key maps to an object that is not a Long. </exception> <exception cref="!:">NumberFormatException is thrown if the value mapped by the key has not a valid number format. </exception> </member> <member name="M:Commons.Collections.ExtendedProperties.GetLong(System.String,System.Int64)"> <summary> Get a long associated with the given configuration key. * </summary> <param name="key">The configuration key. </param> <param name="defaultValue">The default value. </param> <returns>The associated long if key is found and has valid format, default value otherwise. </returns> <exception cref="!:">ClassCastException is thrown if the key maps to an object that is not a Long. </exception> <exception cref="!:">NumberFormatException is thrown if the value mapped by the key has not a valid number format. </exception> </member> <member name="M:Commons.Collections.ExtendedProperties.GetFloat(System.String)"> <summary> Get a float associated with the given configuration key. * </summary> <param name="key">The configuration key. </param> <returns>The associated float. </returns> <exception cref="!:">NoSuchElementException is thrown if the key doesn't map to an existing object. </exception> <exception cref="!:">ClassCastException is thrown if the key maps to an object that is not a Float. </exception> <exception cref="!:">NumberFormatException is thrown if the value mapped by the key has not a valid number format. </exception> </member> <member name="M:Commons.Collections.ExtendedProperties.GetFloat(System.String,System.Single)"> <summary> Get a float associated with the given configuration key. * </summary> <param name="key">The configuration key. </param> <param name="defaultValue">The default value. </param> <returns>The associated float if key is found and has valid format, default value otherwise. </returns> <exception cref="!:">ClassCastException is thrown if the key maps to an object that is not a Float. </exception> <exception cref="!:">NumberFormatException is thrown if the value mapped by the key has not a valid number format. </exception> </member> <member name="M:Commons.Collections.ExtendedProperties.GetDouble(System.String)"> <summary> Get a double associated with the given configuration key. * </summary> <param name="key">The configuration key. </param> <returns>The associated double. </returns> <exception cref="!:">NoSuchElementException is thrown if the key doesn't map to an existing object. </exception> <exception cref="!:">ClassCastException is thrown if the key maps to an object that is not a Double. </exception> <exception cref="!:">NumberFormatException is thrown if the value mapped by the key has not a valid number format. </exception> </member> <member name="M:Commons.Collections.ExtendedProperties.GetDouble(System.String,System.Double)"> <summary> Get a double associated with the given configuration key. * </summary> <param name="key">The configuration key. </param> <param name="defaultValue">The default value. </param> <returns>The associated double if key is found and has valid format, default value otherwise. </returns> <exception cref="!:">ClassCastException is thrown if the key maps to an object that is not a Double. </exception> <exception cref="!:">NumberFormatException is thrown if the value mapped by the key has not a valid number format. </exception> </member> <member name="M:Commons.Collections.ExtendedProperties.ConvertProperties(Commons.Collections.ExtendedProperties)"> <summary> Convert a standard properties class into a configuration class. * </summary> <param name="p">properties object to convert into a ExtendedProperties object. * </param> <returns>ExtendedProperties configuration created from the properties object. </returns> </member> <member name="T:Commons.Collections.PropertiesReader"> <summary> This class is used to read properties lines. These lines do not terminate with new-line chars but rather when there is no backslash sign a the end of the line. This is used to concatenate multiple lines for readability. </summary> </member> <member name="M:Commons.Collections.PropertiesReader.#ctor(System.IO.StreamReader)"> <summary> Constructor. </summary> <param name="reader">A Reader.</param> </member> <member name="M:Commons.Collections.PropertiesReader.ReadProperty"> <summary> Read a property. </summary> <returns>A String.</returns> </member> <member name="T:Commons.Collections.PropertiesTokenizer"> <summary> This class divides into tokens a property value. Token separator is "," but commas into the property value are escaped using the backslash in front. </summary> </member> <member name="F:Commons.Collections.PropertiesTokenizer.DELIMITER"> <summary> The property delimiter used while parsing (a comma). </summary> </member> <member name="M:Commons.Collections.PropertiesTokenizer.#ctor(System.String)"> <summary> Constructor. </summary> <param name="string">A String</param> </member> <member name="M:Commons.Collections.PropertiesTokenizer.HasMoreTokens"> <summary> Check whether the object has more tokens. </summary> <returns>True if the object has more tokens. </returns> </member> <member name="M:Commons.Collections.PropertiesTokenizer.NextToken"> <summary> Get next token. </summary> <returns>A String</returns> </member> </members> </doc> --- NEW FILE: NVelocity.dll --- (This appears to be a binary file; contents omitted.) --- NEW FILE: NVelocity.license.txt --- /* * ==================================================================== * * The Apache Software License, Version 1.1 * * Copyright (c) 2002 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowledgement: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgement may appear in the software itself, * if and wherever such third-party acknowledgements normally appear. * * 4. The names "The Jakarta Project", "Velocity", and "Apache Software * Foundation" must not be used to endorse or promote products derived * from this software without prior written permission. For written * permission, please contact ap...@ap.... * * 5. Products derived from this software may not be called "Apache", * "Velocity" nor may "Apache" appear in their names without prior * written permission of the Apache Group. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * <http://www.apache.org/>. * */ |
From: Michael D. <mik...@us...> - 2004-12-30 16:46:39
|
Update of /cvsroot/nhibernate/NHibernateContrib/lib/net/1.1 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24380 Added Files: log4net.license.txt nunit.framework.license.txt Log Message: Added license files for log4net and nunit.framework. --- NEW FILE: nunit.framework.license.txt --- (This appears to be a binary file; contents omitted.) --- NEW FILE: log4net.license.txt --- /* * ============================================================================ * The Apache Software License, Version 1.1 * ============================================================================ * * Copyright (C) 1999 The Apache Software Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without modifica- * tion, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. The end-user documentation included with the redistribution, if any, must * include the following acknowledgment: "This product includes software * developed by the Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, if * and wherever such third-party acknowledgments normally appear. * * 4. The names "log4j" and "Apache Software Foundation" must not be used to * endorse or promote products derived from this software without prior * written permission. For written permission, please contact * ap...@ap.... * * 5. Products derived from this software may not be called "Apache", nor may * "Apache" appear in their name, without prior written permission of the * Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- * DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * This software consists of voluntary contributions made by many individuals * on behalf of the Apache Software Foundation. For more information on the * Apache Software Foundation, please see <http://www.apache.org/>. * */ |
From: Michael D. <mik...@us...> - 2004-12-30 16:46:05
|
Update of /cvsroot/nhibernate/nhibernate In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24094 Modified Files: NHibernateSolution.build releasenotes.txt Added Files: .cvsignore Log Message: Changes to NHibernate project file organization. Updated release notes for upcoming build. --- NEW FILE: .cvsignore --- build Index: NHibernateSolution.build =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/NHibernateSolution.build,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** NHibernateSolution.build 27 Dec 2004 23:12:29 -0000 1.22 --- NHibernateSolution.build 30 Dec 2004 16:45:39 -0000 1.23 *************** *** 124,132 **** <copy todir="${build.dir}/bin"> <fileset basedir="lib"> - <includes name="Commons.*" /> - <includes name="DotNetMock.*" /> <includes name="HashCodeProvider.*" /> - <includes name="NAnt.Core.*" /> - <includes name="NVelocity.*" /> </fileset> </copy> --- 124,128 ---- *************** *** 151,156 **** <nant target="build" buildfile="src/NHibernate.DomainModel/NHibernate.DomainModel.build" /> <nant target="build" buildfile="src/NHibernate.Test/NHibernate.Test.build" /> - <nant target="build" buildfile="src/NHibernate.Tool.hbm2net/NHibernate.Tool.hbm2net.build" /> - <nant target="build" buildfile="src/NHibernate.Tasks/NHibernate.Tasks.build" /> <nant target="build" buildfile="src/NHibernate.Examples/NHibernate.Examples.build" /> --- 147,150 ---- *************** *** 299,302 **** --- 293,300 ---- <excludes name="${clover.src}/**" /> + <!-- exclude ReSharper stuff --> + <excludes name="**/_ReSharper*/**" /> + <excludes name="**/*.resharperoptions" /> + <includes name="src/**" /> *************** *** 312,319 **** <excludes name="**/obj/**" /> - <!-- exclude ReSharper stuff --> - <excludes name="**/_ReSharper*" /> - <excludes name="**/*.resharperoptions" /> - <!-- exclude any keys that exist on the build machine --> <excludes name="**/*.snk" /> --- 310,313 ---- Index: releasenotes.txt =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/releasenotes.txt,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** releasenotes.txt 6 Dec 2004 02:35:32 -0000 1.22 --- releasenotes.txt 30 Dec 2004 16:45:39 -0000 1.23 *************** *** 1,7 **** --- 1,17 ---- Build 0.6.0.0 ======================== + - Added support for proxy="" on classes. + - Added a configuration parameter "hibernate.prepare_sql" to turn on or off calls to IDbCommand.Prepare(). + - Added NHibernate Type for System.SByte. (Sergey Koshcheyev) + - Added support for mapping subclasses and joined-subclasses in different files through addition of extends attribute. (Andrew Mayorov) + - Added support for LIMIT to MySQLDialect. (Sergey Koshcheyev) - Removed DbType {get;} from IUserType. - Fixed problem with spaces in sql generated from hql and MySql. - Modified logging in Transaction to not generate as many messages. + - Modified how exceptions are rethrown so call stack of original exception is not lost. + - Fixed bug with Configuration when there is a class without a namespace. + - Fixed bug with Sql generated for an IN clause that contains a class/subclass with a discriminator-value="null". + - Improved error messages when IDbCommand and IDbConnection can't be found by the IDriver. + - Fixed potential threading problem with QueryTranslator. Build 0.5.0.0 |
From: Michael D. <mik...@us...> - 2004-12-30 16:44:32
|
Update of /cvsroot/nhibernate/nhibernate/lib/net/1.1 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23891 Added Files: log4net.license.txt nunit.framework.license.txt Log Message: Added license files for log4net and nunit.framework. --- NEW FILE: nunit.framework.license.txt --- (This appears to be a binary file; contents omitted.) --- NEW FILE: log4net.license.txt --- /* * ============================================================================ * The Apache Software License, Version 1.1 * ============================================================================ * * Copyright (C) 1999 The Apache Software Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without modifica- * tion, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. The end-user documentation included with the redistribution, if any, must * include the following acknowledgment: "This product includes software * developed by the Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, if * and wherever such third-party acknowledgments normally appear. * * 4. The names "log4j" and "Apache Software Foundation" must not be used to * endorse or promote products derived from this software without prior * written permission. For written permission, please contact * ap...@ap.... * * 5. Products derived from this software may not be called "Apache", nor may * "Apache" appear in their name, without prior written permission of the * Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- * DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * This software consists of voluntary contributions made by many individuals * on behalf of the Apache Software Foundation. For more information on the * Apache Software Foundation, please see <http://www.apache.org/>. * */ |
From: Michael D. <mik...@us...> - 2004-12-30 16:39:08
|
Update of /cvsroot/nhibernate/nhibernate/doc/reference/en/modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22639 Modified Files: configuration.xml Log Message: Fixed minor problem with code typed in the docs. Index: configuration.xml =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/doc/reference/en/modules/configuration.xml,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** configuration.xml 20 Dec 2004 00:35:52 -0000 1.1 --- configuration.xml 30 Dec 2004 16:38:51 -0000 1.2 *************** *** 84,89 **** Configuration cfg = new Configuration() .AddClass( typeof(NHibernate.Auction.Item) ) ! .AddClass( typeof(NHibernate.Auction.Bid) ) ! .Properties = props;]]></programlisting> <para> --- 84,89 ---- Configuration cfg = new Configuration() .AddClass( typeof(NHibernate.Auction.Item) ) ! .AddClass( typeof(NHibernate.Auction.Bid) ); ! cfg.Properties = props;]]></programlisting> <para> |
From: Michael D. <mik...@us...> - 2004-12-30 16:38:18
|
Update of /cvsroot/nhibernate/nhibernate/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22518 Removed Files: Commons.dll Commons.xml DotNetMock.Core.dll DotNetMock.dll DotNetMock.Framework.dll NAnt.Core.dll NAnt.Core.xml NVelocity.dll NVelocity.xml Log Message: Moved NHibernate.Tasks and NHibernate.Tool.hbm2net over to the NHibernateContrib module. Removed dependency on DotNetMock --- Commons.xml DELETED --- --- NVelocity.dll DELETED --- --- Commons.dll DELETED --- --- NAnt.Core.dll DELETED --- --- DotNetMock.Framework.dll DELETED --- --- DotNetMock.dll DELETED --- --- DotNetMock.Core.dll DELETED --- --- NVelocity.xml DELETED --- --- NAnt.Core.xml DELETED --- |
From: Michael D. <mik...@us...> - 2004-12-30 16:36:00
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.Tasks In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21970 Removed Files: .cvsignore AssemblyInfo.cs Hbm2NetTask.cs NHibernate.Tasks-1.1.csproj NHibernate.Tasks.build Log Message: Moved NHibernate.Tasks and NHibernate.Tool.hbm2net over to the NHibernateContrib module. --- .cvsignore DELETED --- --- NHibernate.Tasks-1.1.csproj DELETED --- --- AssemblyInfo.cs DELETED --- --- NHibernate.Tasks.build DELETED --- --- Hbm2NetTask.cs DELETED --- |
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.Tool.hbm2net In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21817 Removed Files: .cvsignore AbstractRenderer.cs App.config AssemblyInfo.cs BasicRenderer.cs ClassMapping.cs ClassName.cs CodeGenerator.cs convert.vm DOMRenderer.cs FieldProperty.cs FinderRenderer.cs Generator.cs JavaTool.cs MappingElement.cs MetaAttributeHelper.cs MethodSignatureBuilder.cs NHibernate.Tool.hbm2net-1.1.csproj NHibernate.Tool.hbm2net.build QueryBuilder.cs Renderer.cs StringResourceLoader.cs SupportClass.cs VelocityRenderer.cs Log Message: Moved NHibernate.Tasks and NHibernate.Tool.hbm2net over to the NHibernateContrib module. --- Renderer.cs DELETED --- --- MetaAttributeHelper.cs DELETED --- --- FinderRenderer.cs DELETED --- --- CodeGenerator.cs DELETED --- --- Generator.cs DELETED --- --- BasicRenderer.cs DELETED --- --- ClassMapping.cs DELETED --- --- NHibernate.Tool.hbm2net.build DELETED --- --- MethodSignatureBuilder.cs DELETED --- --- ClassName.cs DELETED --- --- AbstractRenderer.cs DELETED --- --- .cvsignore DELETED --- --- App.config DELETED --- --- NHibernate.Tool.hbm2net-1.1.csproj DELETED --- --- DOMRenderer.cs DELETED --- --- FieldProperty.cs DELETED --- --- QueryBuilder.cs DELETED --- --- MappingElement.cs DELETED --- --- StringResourceLoader.cs DELETED --- --- convert.vm DELETED --- --- VelocityRenderer.cs DELETED --- --- AssemblyInfo.cs DELETED --- --- SupportClass.cs DELETED --- --- JavaTool.cs DELETED --- |
From: Michael D. <mik...@us...> - 2004-12-30 16:25:52
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.Test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19437/src/NHibernate.Test Modified Files: NHibernate.Test-1.1.csproj NHibernate.Test.build Log Message: Removed dependency on DotNetMock from the Test assembly. Modified the test that were dependant on DotNetMock. Index: NHibernate.Test.build =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/NHibernate.Test.build,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** NHibernate.Test.build 10 Dec 2004 16:40:02 -0000 1.13 --- NHibernate.Test.build 30 Dec 2004 16:25:12 -0000 1.14 *************** *** 50,55 **** <includes name="System.XML.dll" /> <includes name="System.Data.dll" /> - <includes name="DotNetMock.dll" /> - <includes name="DotNetMock.Framework.dll" /> <includes name="Iesi.Collections.dll" /> <includes name="log4net.dll" /> --- 50,53 ---- *************** *** 95,98 **** --- 93,97 ---- assemblyname="${build.dir}/bin/${nant.project.name}.dll" appconfig="${build.dir}/bin/${nant.project.name}.dll.config" + failonerror="false" /> </nunit2> Index: NHibernate.Test-1.1.csproj =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/NHibernate.Test-1.1.csproj,v retrieving revision 1.56 retrieving revision 1.57 diff -C2 -d -r1.56 -r1.57 *** NHibernate.Test-1.1.csproj 16 Dec 2004 21:56:06 -0000 1.56 --- NHibernate.Test-1.1.csproj 30 Dec 2004 16:25:12 -0000 1.57 *************** *** 101,114 **** /> <Reference - Name = "DotNetMock.Framework" - AssemblyName = "DotNetMock.Framework" - HintPath = "..\..\lib\DotNetMock.Framework.dll" - /> - <Reference - Name = "DotNetMock" - AssemblyName = "DotNetMock" - HintPath = "..\..\lib\DotNetMock.dll" - /> - <Reference Name = "Iesi.Collections" AssemblyName = "Iesi.Collections" --- 101,104 ---- *************** *** 620,628 **** /> <File - RelPath = "TypesTest\BaseTypeFixture.cs" - SubType = "Code" - BuildAction = "Compile" - /> - <File RelPath = "TypesTest\BinaryBlobClass.cs" SubType = "Code" --- 610,613 ---- *************** *** 653,656 **** --- 638,650 ---- /> <File + RelPath = "TypesTest\BooleanClass.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "TypesTest\BooleanClass.hbm.xml" + BuildAction = "EmbeddedResource" + /> + <File RelPath = "TypesTest\BooleanTypeFixture.cs" SubType = "Code" *************** *** 658,661 **** --- 652,664 ---- /> <File + RelPath = "TypesTest\ByteClass.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "TypesTest\ByteClass.hbm.xml" + BuildAction = "EmbeddedResource" + /> + <File RelPath = "TypesTest\ByteTypeFixture.cs" SubType = "Code" *************** *** 668,671 **** --- 671,683 ---- /> <File + RelPath = "TypesTest\DecimalClass.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "TypesTest\DecimalClass.hbm.xml" + BuildAction = "EmbeddedResource" + /> + <File RelPath = "TypesTest\DecimalTypeFixture.cs" SubType = "Code" *************** *** 687,690 **** --- 699,711 ---- /> <File + RelPath = "TypesTest\GuidClass.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "TypesTest\GuidClass.hbm.xml" + BuildAction = "EmbeddedResource" + /> + <File RelPath = "TypesTest\GuidTypeFixture.cs" SubType = "Code" |
From: Michael D. <mik...@us...> - 2004-12-30 16:25:52
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/NHSpecificTest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19437/src/NHibernate.Test/NHSpecificTest Modified Files: BasicClassFixture.cs Log Message: Removed dependency on DotNetMock from the Test assembly. Modified the test that were dependant on DotNetMock. Index: BasicClassFixture.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/NHSpecificTest/BasicClassFixture.cs,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** BasicClassFixture.cs 12 Dec 2004 07:18:24 -0000 1.11 --- BasicClassFixture.cs 30 Dec 2004 16:25:13 -0000 1.12 *************** *** 81,99 **** index++; - - // make sure the previous updates went through - s[index] = sessions.OpenSession(); - t[index] = s[index].BeginTransaction(); - - bc[index] = (BasicClass)s[index].Load(typeof(BasicClass), id); - AssertPropertiesEqual(bc[index-1], bc[index]); - - bc[index].BooleanProperty = false; - s[index].Update(bc[index]); - - t[index].Commit(); - s[index].Close(); - - index++; // make sure the previous updates went through --- 81,84 ---- *************** *** 104,122 **** AssertPropertiesEqual(bc[index-1], bc[index]); - bc[index].ByteProperty = Byte.MinValue; - s[index].Update(bc[index]); - - t[index].Commit(); - s[index].Close(); - - index++; - - // make sure the previous updates went through - s[index] = sessions.OpenSession(); - t[index] = s[index].BeginTransaction(); - - bc[index] = (BasicClass)s[index].Load(typeof(BasicClass), id); - AssertPropertiesEqual(bc[index-1], bc[index]); - bc[index].CharacterProperty = 'b'; s[index].Update(bc[index]); --- 89,92 ---- *************** *** 181,199 **** AssertPropertiesEqual(bc[index-1], bc[index]); - bc[index].DecimalProperty = 5.55555M; - s[index].Update(bc[index]); - - t[index].Commit(); - s[index].Close(); - - index++; - - // make sure the previous updates went through - s[index] = sessions.OpenSession(); - t[index] = s[index].BeginTransaction(); - - bc[index] = (BasicClass)s[index].Load(typeof(BasicClass), id); - AssertPropertiesEqual(bc[index-1], bc[index]); - bc[index].Int16Property = Int16.MinValue; s[index].Update(bc[index]); --- 151,154 ---- *************** *** 887,899 **** { Assert.AreEqual(expected.Id, actual.Id, "Id"); - Assert.AreEqual(expected.BooleanProperty, actual.BooleanProperty, "BooleanProperty"); - Assert.AreEqual(expected.ByteProperty, actual.ByteProperty, "ByteProperty"); Assert.AreEqual(expected.CharacterProperty, actual.CharacterProperty, "CharacterProperty"); Assert.AreEqual(expected.ClassProperty, actual.ClassProperty, "ClassProperty"); Assert.AreEqual(expected.CultureInfoProperty, actual.CultureInfoProperty, "CultureInfoProperty"); Assert.AreEqual(expected.DateTimeProperty, actual.DateTimeProperty, "DateTimeProperty"); - Assert.AreEqual(expected.DecimalProperty, actual.DecimalProperty, "DecimalProperty using Assert should be AreEqual"); - Assert.IsTrue(expected.DecimalProperty.Equals(actual.DecimalProperty), "DecimalProperty"); - // Assert.AreEqual(expected.DoubleProperty, actual.DoubleProperty, 0, "DoubleProperty"); Assert.AreEqual(expected.Int16Property, actual.Int16Property, "Int16Property"); Assert.AreEqual(expected.Int32Property, actual.Int32Property, "Int32Property"); --- 842,849 ---- *************** *** 921,932 **** basicClass.Id = id; - - basicClass.BooleanProperty = true; - basicClass.ByteProperty = Byte.MaxValue; basicClass.CharacterProperty = 'a'; basicClass.ClassProperty = typeof(object); basicClass.CultureInfoProperty = System.Globalization.CultureInfo.CurrentCulture; basicClass.DateTimeProperty = DateTime.Parse("2003-12-01 10:45:21 AM"); - basicClass.DecimalProperty = 5.64351M; basicClass.Int16Property = Int16.MaxValue; basicClass.Int32Property = Int32.MaxValue; --- 871,878 ---- |
From: Michael D. <mik...@us...> - 2004-12-30 16:25:51
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.DomainModel/NHSpecific In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19437/src/NHibernate.DomainModel/NHSpecific Modified Files: BasicClass.cs BasicClass.hbm.xml Log Message: Removed dependency on DotNetMock from the Test assembly. Modified the test that were dependant on DotNetMock. Index: BasicClass.hbm.xml =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.DomainModel/NHSpecific/BasicClass.hbm.xml,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** BasicClass.hbm.xml 23 Oct 2004 15:01:19 -0000 1.6 --- BasicClass.hbm.xml 30 Dec 2004 16:25:12 -0000 1.7 *************** *** 11,21 **** </id> - <property name="BooleanProperty" type="Boolean" column="bool_p"/> - <property name="ByteProperty" type="Byte" column="byte_p"/> <property name="CharacterProperty" type="Char" column="char_p" length="1"/> <property name="ClassProperty" type="Type" column="class_p"/> <property name="CultureInfoProperty" type="CultureInfo" column="cinfo_p"/> <property name="DateTimeProperty" type="DateTime" column="dtm_p"/> - <property name="DecimalProperty" type="Decimal(19,5)" column="decm_p"/> <property name="Int16Property" type="Int16" column="shrt_p" /> <property name="Int32Property" type="Int32" column="int_p"/> --- 11,18 ---- Index: BasicClass.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.DomainModel/NHSpecific/BasicClass.cs,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** BasicClass.cs 18 Nov 2004 02:45:43 -0000 1.7 --- BasicClass.cs 30 Dec 2004 16:25:12 -0000 1.8 *************** *** 12,22 **** private int _id; - private bool _booleanProperty; - private byte _byteProperty; private char _characterProperty; private System.Type _classProperty; private System.Globalization.CultureInfo _cultureInfoProperty; private DateTime _dateTimeProperty; - private decimal _decimalProperty; private short _int16Property; private int _int32Property; --- 12,19 ---- *************** *** 49,64 **** } - public bool BooleanProperty - { - get {return _booleanProperty;} - set {_booleanProperty = value;} - } - - public byte ByteProperty - { - get {return _byteProperty;} - set {_byteProperty = value;} - } - public char CharacterProperty { --- 46,49 ---- *************** *** 85,94 **** } - public decimal DecimalProperty - { - get {return _decimalProperty;} - set {_decimalProperty = value;} - } - public short Int16Property { --- 70,73 ---- |
From: Michael D. <mik...@us...> - 2004-12-30 16:25:30
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/TypesTest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19437/src/NHibernate.Test/TypesTest Modified Files: BooleanTypeFixture.cs ByteTypeFixture.cs DecimalTypeFixture.cs GuidTypeFixture.cs PersistentEnumTypeFixture.cs Added Files: BooleanClass.cs BooleanClass.hbm.xml ByteClass.cs ByteClass.hbm.xml DecimalClass.cs DecimalClass.hbm.xml GuidClass.cs GuidClass.hbm.xml Removed Files: BaseTypeFixture.cs Log Message: Removed dependency on DotNetMock from the Test assembly. Modified the test that were dependant on DotNetMock. --- NEW FILE: GuidClass.hbm.xml --- (This appears to be a binary file; contents omitted.) --- NEW FILE: ByteClass.cs --- using System; namespace NHibernate.Test.TypesTest { /// <summary> /// Summary description for ByteClass. /// </summary> public class ByteClass { int _id; byte _byteValue; public ByteClass() { } public int Id { get { return _id; } set { _id = value; } } public byte ByteValue { get { return _byteValue; } set { _byteValue = value; } } } } --- NEW FILE: BooleanClass.cs --- using System; namespace NHibernate.Test.TypesTest { /// <summary> /// Summary description for BooleanClass. /// </summary> public class BooleanClass { int _id; bool _booleanValue; public BooleanClass() { } public int Id { get { return _id; } set { _id = value; } } public bool BooleanValue { get {return _booleanValue;} set {_booleanValue = value;} } } } Index: GuidTypeFixture.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/TypesTest/GuidTypeFixture.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** GuidTypeFixture.cs 12 Dec 2004 07:18:27 -0000 1.3 --- GuidTypeFixture.cs 30 Dec 2004 16:25:19 -0000 1.4 *************** *** 1,4 **** using System; - using System.Data; using NHibernate.Type; --- 1,3 ---- *************** *** 11,75 **** /// </summary> [TestFixture] ! public class GuidTypeFixture : BaseTypeFixture { ! /// <summary> ! /// Test that Get(IDataReader, index) returns a boxed Guid value that is what ! /// we expect. ! /// </summary> ! [Test] ! public void Get() ! { ! NullableType type = NHibernate.Guid; ! ! Guid expected = new Guid("{01234567-abcd-abcd-abcd-0123456789ab}"); ! ! // move to the first record ! reader.Read(); ! Guid actual = (Guid)type.Get(reader, GuidTypeColumnIndex); ! Assert.AreEqual(expected, actual); } ! [Test] ! public void EqualsTrue() { ! Guid lhs = new Guid("{01234567-abcd-abcd-abcd-0123456789ab}"); ! Guid rhs = new Guid("{01234567-abcd-abcd-abcd-0123456789ab}"); ! NullableType type = NHibernate.Guid; ! Assert.IsTrue(type.Equals(lhs, rhs)); } [Test] ! public void EqualsFalse() { Guid lhs = new Guid("{01234567-abcd-abcd-abcd-0123456789ab}"); ! Guid rhs = new Guid("{11234567-abcd-abcd-abcd-0123456789ab}"); ! NullableType type = NHibernate.Guid; ! Assert.IsFalse(type.Equals(lhs, rhs)); } - /// <summary> - /// Test to make sure that a boxed Guid and a struct Guid compare the - /// same as two struct Guids. - /// </summary> [Test] ! public void EqualsWithSnapshot() { ! Guid busObjValue = new Guid("{01234567-abcd-abcd-abcd-0123456789ab}"); ! object snapshotValue = busObjValue; ! NullableType type = NHibernate.Guid; ! Assert.IsTrue(type.Equals(busObjValue, snapshotValue)); ! // simulate the UI changing the busObjValue ! busObjValue = new Guid("{11234567-abcd-abcd-abcd-0123456789ab}"); ! Assert.IsFalse(type.Equals(busObjValue, snapshotValue)); ! } } } \ No newline at end of file --- 10,86 ---- /// </summary> [TestFixture] ! public class GuidTypeFixture : TestCase { ! #region NUnit.Framework.TestFixture Members ! [TestFixtureSetUp] ! public void TestFixtureSetUp() ! { ! ExportSchema( new string[] { "TypesTest.GuidClass.hbm.xml"}, true, "NHibernate.Test" ); ! } + [SetUp] + public void SetUp() + { + // there are test in here where we don't need to resetup the + // tables - so only set the tables up once } ! [TearDown] ! public override void TearDown() { ! // do nothing except not let the base TearDown get called ! } ! [TestFixtureTearDown] ! public void TestFixtureTearDown() ! { ! base.TearDown(); } + #endregion + + /// <summary> + /// Verify Equals will correctly determine when the property + /// is dirty. + /// </summary> [Test] ! public void Equals() { + GuidType type = (GuidType)NHibernate.Guid; + Guid lhs = new Guid("{01234567-abcd-abcd-abcd-0123456789ab}"); ! Guid rhs = new Guid("{01234567-abcd-abcd-abcd-0123456789ab}"); ! Assert.IsTrue( type.Equals( lhs, rhs ) ); ! rhs = new Guid("{11234567-abcd-abcd-abcd-0123456789ab}"); ! ! Assert.IsFalse( type.Equals( lhs, rhs ) ); ! } [Test] ! public void ReadWrite() { + Guid val = new Guid("{01234567-abcd-abcd-abcd-0123456789ab}"); ! GuidClass basic = new GuidClass(); ! basic.Id = 1; ! basic.GuidValue = val; ! ISession s = sessions.OpenSession(); ! s.Save(basic); ! s.Flush(); ! s.Close(); ! s = sessions.OpenSession(); ! basic = (GuidClass)s.Load( typeof(GuidClass), 1 ); ! Assert.AreEqual( val, basic.GuidValue ); + s.Delete( basic ); + s.Flush(); + s.Close(); + } } } \ No newline at end of file Index: DecimalTypeFixture.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/TypesTest/DecimalTypeFixture.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** DecimalTypeFixture.cs 22 Mar 2004 04:34:47 -0000 1.2 --- DecimalTypeFixture.cs 30 Dec 2004 16:25:19 -0000 1.3 *************** *** 1,4 **** using System; - using System.Data; using NHibernate.Type; --- 1,3 ---- *************** *** 11,93 **** /// </summary> [TestFixture] ! public class DecimalTypeFixture : BaseTypeFixture { ! /// <summary> ! /// Test that two decimal fields that are exactly equal are returned ! /// as Equal by the DecimalType. ! /// </summary> ! [Test] ! public void Equals() { ! decimal lhs = 5.64351M; ! decimal rhs = 5.64351M; ! NullableType type = NHibernate.Decimal; ! Assert.IsTrue(type.Equals(lhs, rhs)); } ! /// <summary> ! /// Test that two decimal fields that are equal except one has a higher precision than ! /// the other one are returned as Equal by the DecimalType. ! /// </summary> ! [Test] ! public void EqualsWithDiffPrecision() { ! decimal lhs = 5.64351M; ! decimal rhs = 5.643510M; ! NullableType type = NHibernate.Decimal; ! Assert.IsTrue(type.Equals(lhs, rhs)); } /// <summary> ! /// Test that Get(IDataReader, index) returns a boxed Decimal value that is what ! /// we expect. /// </summary> - /// <remarks> - /// A Decimal variable holding <c>5.64531M</c> should be equal to a - /// <c>5.46531M</c> read from a IDataReader. - /// </remarks> [Test] ! public void Get() { ! NullableType type = TypeFactory.GetDecimalType(19, 5); ! decimal expected = 5.64351M; ! // move to the first record ! reader.Read(); ! ! decimal actualValue = (decimal)type.Get(reader, DecimalTypeColumnIndex); ! Assert.AreEqual(expected, actualValue); ! } - /// <summary> - /// Test that a System.Decimal created with an extra <c>0</c> will still be equal - /// to the System.Decimal without the last <c>0</c> - /// </summary> - /// <remarks> - /// A decimal variable initialized to <c>5.643510M</c> should be - /// equal to a <c>5.64351M</c> read from a IDataReader. - /// </remarks> [Test] ! public void GetWithDiffPrecision() { ! NullableType type = TypeFactory.GetDecimalType(19, 5); ! decimal expected = 5.643510M; ! ! // move to the first record ! reader.Read(); ! decimal actualValue = (decimal)type.Get(reader, DecimalTypeColumnIndex); ! Assert.AreEqual(expected, actualValue, "Expected double equals Actual"); ! ! ! } } } --- 10,88 ---- /// </summary> [TestFixture] ! public class DecimalTypeFixture : TestCase { ! #region NUnit.Framework.TestFixture Members ! ! [TestFixtureSetUp] ! public void TestFixtureSetUp() { ! ExportSchema( new string[] { "TypesTest.DecimalClass.hbm.xml"}, true, "NHibernate.Test" ); ! } ! [SetUp] ! public void SetUp() ! { ! // there are test in here where we don't need to resetup the ! // tables - so only set the tables up once } ! [TearDown] ! public override void TearDown() { ! // do nothing except not let the base TearDown get called ! } ! [TestFixtureTearDown] ! public void TestFixtureTearDown() ! { ! base.TearDown(); } + #endregion + /// <summary> ! /// Test that two decimal fields that are exactly equal are returned ! /// as Equal by the DecimalType. /// </summary> [Test] ! public void Equals() { ! decimal lhs = 5.64351M; ! decimal rhs = 5.64351M; ! DecimalType type = (DecimalType)NHibernate.Decimal; ! Assert.IsTrue( type.Equals(lhs, rhs) ); ! // Test that two decimal fields that are equal except one has a higher precision than ! // the other one are returned as Equal by the DecimalType. ! rhs = 5.643510M; ! Assert.IsTrue(type.Equals(lhs, rhs)); } [Test] ! public void ReadWrite() { ! decimal expected = 5.64351M; ! DecimalClass basic = new DecimalClass(); ! basic.Id = 1; ! basic.DecimalValue = expected; ! ISession s = sessions.OpenSession(); ! s.Save(basic); ! s.Flush(); ! s.Close(); + s = sessions.OpenSession(); + basic = (DecimalClass)s.Load( typeof(DecimalClass), 1 ); + Assert.AreEqual( expected, basic.DecimalValue ); + Assert.AreEqual( 5.643510M, basic.DecimalValue ); + + s.Delete( basic ); + s.Flush(); + s.Close(); + } } } --- NEW FILE: GuidClass.cs --- using System; namespace NHibernate.Test.TypesTest { /// <summary> /// Summary description for GuidClass. /// </summary> public class GuidClass { int _id; Guid _guidValue; public GuidClass() { } public int Id { get { return _id; } set { _id = value; } } public Guid GuidValue { get { return _guidValue; } set { _guidValue = value; } } } } Index: BooleanTypeFixture.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/TypesTest/BooleanTypeFixture.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** BooleanTypeFixture.cs 12 Dec 2004 07:18:27 -0000 1.2 --- BooleanTypeFixture.cs 30 Dec 2004 16:25:13 -0000 1.3 *************** *** 1,4 **** using System; - using System.Data; using NHibernate.Type; --- 1,3 ---- *************** *** 11,33 **** /// </summary> [TestFixture] ! public class BooleanTypeFixture : BaseTypeFixture { /// <summary> ! /// Test that Get(IDataReader, index) returns a boxed Boolean value that is what ! /// we expect. /// </summary> [Test] ! public void Get() { ! NullableType type = NHibernate.Boolean; ! bool expected = true; ! ! // move to the first record ! reader.Read(); ! bool actual = (bool)type.Get(reader, BooleanTypeColumnIndex); ! Assert.AreEqual(expected, actual); } } --- 10,78 ---- /// </summary> [TestFixture] ! public class BooleanTypeFixture : TestCase { + #region NUnit.Framework.TestFixture Members + + [TestFixtureSetUp] + public void TestFixtureSetUp() + { + ExportSchema( new string[] { "TypesTest.BooleanClass.hbm.xml"}, true, "NHibernate.Test" ); + } + + [SetUp] + public void SetUp() + { + // there are test in here where we don't need to resetup the + // tables - so only set the tables up once + } + + [TearDown] + public override void TearDown() + { + // do nothing except not let the base TearDown get called + } + + [TestFixtureTearDown] + public void TestFixtureTearDown() + { + base.TearDown(); + } + + #endregion + /// <summary> ! /// Verify Equals will correctly determine when the property ! /// is dirty. /// </summary> [Test] ! public void Equals() { ! BooleanType type = (BooleanType)NHibernate.Boolean; ! Assert.IsTrue( type.Equals( true, true ) ); ! Assert.IsTrue( type.Equals( false, false ) ); ! Assert.IsFalse( type.Equals( true, false ) ); ! } ! [Test] ! public void ReadWrite() ! { ! BooleanClass basic = new BooleanClass(); ! basic.Id = 1; ! basic.BooleanValue = true; ! ! ISession s = sessions.OpenSession(); ! s.Save(basic); ! s.Flush(); ! s.Close(); + s = sessions.OpenSession(); + basic = (BooleanClass)s.Load( typeof(BooleanClass), 1 ); + + Assert.AreEqual( true, basic.BooleanValue ); + + s.Delete( basic ); + s.Flush(); + s.Close(); } } --- NEW FILE: BooleanClass.hbm.xml --- (This appears to be a binary file; contents omitted.) --- NEW FILE: ByteClass.hbm.xml --- (This appears to be a binary file; contents omitted.) Index: ByteTypeFixture.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/TypesTest/ByteTypeFixture.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ByteTypeFixture.cs 12 Dec 2004 07:18:27 -0000 1.2 --- ByteTypeFixture.cs 30 Dec 2004 16:25:19 -0000 1.3 *************** *** 1,4 **** using System; - using System.Data; using NHibernate.Type; --- 1,3 ---- *************** *** 11,33 **** /// </summary> [TestFixture] ! public class ByteTypeFixture : BaseTypeFixture { /// <summary> ! /// Test that Get(IDataReader, index) returns a boxed Byte value that is what ! /// we expect. /// </summary> [Test] ! public void Get() { ! NullableType type = NHibernate.Byte; ! byte expected = 5; ! // move to the first record ! reader.Read(); ! byte actual = (byte)type.Get(reader, ByteTypeColumnIndex); ! Assert.AreEqual(expected, actual); } } --- 10,79 ---- /// </summary> [TestFixture] ! public class ByteTypeFixture : TestCase { + #region NUnit.Framework.TestFixture Members + + [TestFixtureSetUp] + public void TestFixtureSetUp() + { + ExportSchema( new string[] { "TypesTest.ByteClass.hbm.xml"}, true, "NHibernate.Test" ); + } + + [SetUp] + public void SetUp() + { + // there are test in here where we don't need to resetup the + // tables - so only set the tables up once + } + + [TearDown] + public override void TearDown() + { + // do nothing except not let the base TearDown get called + } + + [TestFixtureTearDown] + public void TestFixtureTearDown() + { + base.TearDown(); + } + + #endregion + /// <summary> ! /// Verify Equals will correctly determine when the property ! /// is dirty. /// </summary> [Test] ! public void Equals() { ! ByteType type = (ByteType)NHibernate.Byte; ! ! Assert.IsTrue( type.Equals( (byte)5, (byte)5 ) ); ! Assert.IsFalse( type.Equals( (byte)5, (byte)6 ) ); ! ! } ! [Test] ! public void ReadWrite() ! { ! ByteClass basic = new ByteClass(); ! basic.Id = 1; ! basic.ByteValue = (byte)43; ! ISession s = sessions.OpenSession(); ! s.Save(basic); ! s.Flush(); ! s.Close(); + s = sessions.OpenSession(); + basic = (ByteClass)s.Load( typeof(ByteClass), 1 ); + + Assert.AreEqual( (byte)43, basic.ByteValue ); + + s.Delete( basic ); + s.Flush(); + s.Close(); } } --- NEW FILE: DecimalClass.hbm.xml --- (This appears to be a binary file; contents omitted.) --- BaseTypeFixture.cs DELETED --- Index: PersistentEnumTypeFixture.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/TypesTest/PersistentEnumTypeFixture.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** PersistentEnumTypeFixture.cs 28 Apr 2004 14:16:18 -0000 1.1 --- PersistentEnumTypeFixture.cs 30 Dec 2004 16:25:19 -0000 1.2 *************** *** 26,30 **** /// </summary> [TestFixture] ! public class PersistentEnumTypeFixture : BaseTypeFixture { [Test] --- 26,30 ---- /// </summary> [TestFixture] ! public class PersistentEnumTypeFixture { [Test] --- NEW FILE: DecimalClass.cs --- using System; namespace NHibernate.Test.TypesTest { /// <summary> /// Summary description for DecimalClass. /// </summary> public class DecimalClass { int _id; decimal _decimalValue; public DecimalClass() { } public int Id { get { return _id; } set { _id = value; } } public decimal DecimalValue { get {return _decimalValue;} set {_decimalValue = value;} } } } |
From: Michael D. <mik...@us...> - 2004-12-30 15:32:10
|
Update of /cvsroot/nhibernate/NHibernateContrib/src/NHibernate.Tasks In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8353/NHibernate.Tasks Log Message: Directory /cvsroot/nhibernate/NHibernateContrib/src/NHibernate.Tasks added to the repository |
From: Michael D. <mik...@us...> - 2004-12-30 15:31:56
|
Update of /cvsroot/nhibernate/NHibernateContrib/src/NHibernate.Tool.hbm2net In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8311/NHibernate.Tool.hbm2net Log Message: Directory /cvsroot/nhibernate/NHibernateContrib/src/NHibernate.Tool.hbm2net added to the repository |
From: Michael D. <mik...@us...> - 2004-12-30 15:31:50
|
Update of /cvsroot/nhibernate/NHibernateContrib/src/NHibernate.Tool.Net2Hbm In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8262/NHibernate.Tool.Net2Hbm Log Message: Directory /cvsroot/nhibernate/NHibernateContrib/src/NHibernate.Tool.Net2Hbm added to the repository |
From: Kevin W. <kev...@us...> - 2004-12-28 16:49:09
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.Tasks In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19219 Modified Files: Hbm2NetTask.cs Log Message: reformat code with ReSharper checking commit privileges Index: Hbm2NetTask.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Tasks/Hbm2NetTask.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Hbm2NetTask.cs 16 Nov 2004 04:21:39 -0000 1.2 --- Hbm2NetTask.cs 28 Dec 2004 16:49:00 -0000 1.3 *************** *** 1,24 **** - using System; - using System.Collections; using System.IO; using System.Text; - - using NAnt.Core; - using NAnt.Core.Types; - using NAnt.Core.Tasks; using NAnt.Core.Attributes; ! ! namespace NHibernate.Tasks { ! [TaskName("hbm2net")] public class Hbm2NetTask : ExternalProgramBase { ! FileSet _set = new FileSet(); ! string _output = null; ! string _config = null; ! string _args = null; ! [BuildElement("fileset", Required=true)] public FileSet Hbm2NetFileSet { --- 1,19 ---- using System.IO; using System.Text; using NAnt.Core.Attributes; + using NAnt.Core.Tasks; + using NAnt.Core.Types; ! namespace NHibernate.Tasks { ! [TaskName( "hbm2net" )] public class Hbm2NetTask : ExternalProgramBase { ! private FileSet _set = new FileSet(); ! private string _output = null; ! private string _config = null; ! private string _args = null; ! [BuildElement( "fileset", Required=true )] public FileSet Hbm2NetFileSet { *************** *** 27,31 **** } ! [TaskAttribute("output")] public string Output { --- 22,26 ---- } ! [TaskAttribute( "output" )] public string Output { *************** *** 34,38 **** } ! [TaskAttribute("config")] public string Config { --- 29,33 ---- } ! [TaskAttribute( "config" )] public string Config { *************** *** 46,50 **** { string asm = this.GetType().Assembly.Location; ! string basename = asm.Substring(0, asm.LastIndexOf(Path.DirectorySeparatorChar)+1); return basename + "NHibernate.Tool.hbm2net.exe"; } --- 41,45 ---- { string asm = this.GetType().Assembly.Location; ! string basename = asm.Substring( 0, asm.LastIndexOf( Path.DirectorySeparatorChar ) + 1 ); return basename + "NHibernate.Tool.hbm2net.exe"; } *************** *** 59,78 **** { StringBuilder sb = new StringBuilder(); ! if(_output != null) { ! sb.Append("--output=\"" + _output + "\" "); } ! if(_config != null) { ! sb.Append("--config=\"" + _config + "\" "); } ! foreach(string filename in _set.FileNames) { ! sb.Append("\"" + filename + "\" "); } _args = sb.ToString(); ! base.ExecuteTask(); } } ! } --- 54,73 ---- { StringBuilder sb = new StringBuilder(); ! if( _output != null ) { ! sb.Append( "--output=\"" + _output + "\" " ); } ! if( _config != null ) { ! sb.Append( "--config=\"" + _config + "\" " ); } ! foreach( string filename in _set.FileNames ) { ! sb.Append( "\"" + filename + "\" " ); } _args = sb.ToString(); ! base.ExecuteTask(); } } ! } \ No newline at end of file |
From: Michael D. <mik...@us...> - 2004-12-28 16:48:06
|
Update of /cvsroot/nhibernate/CVSROOT In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19041 Modified Files: avail Log Message: adding kevinwilliams to the nhibernate module. Index: avail =================================================================== RCS file: /cvsroot/nhibernate/CVSROOT/avail,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** avail 6 Dec 2004 02:33:07 -0000 1.1 --- avail 28 Dec 2004 16:47:56 -0000 1.2 *************** *** 1,3 **** --- 1,4 ---- unavail avail|luggage, kevinwilliams|NHibernateContrib + avail|kevinwilliams|nhibernate avail|mikedoerfler, szoke |
From: Michael D. <mik...@us...> - 2004-12-27 23:12:38
|
Update of /cvsroot/nhibernate/nhibernate In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23928 Modified Files: NHibernateSolution.build readme.html Log Message: Includes excludes for resharper and includes for DynamicProxy Index: readme.html =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/readme.html,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** readme.html 2 Dec 2004 20:50:41 -0000 1.13 --- readme.html 27 Dec 2004 23:12:29 -0000 1.14 *************** *** 48,51 **** --- 48,58 ---- </ul> <p> + This product uses software copyrighted by DigitalCraftsmen (http://www.digitalcraftsmen.com.br) + that is Licensed under the Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0) + </p> + <ul> + <li>Castle.DynamicProxy</li> + </ul> + <p> This product includes source code derived from a sample written by Mattias Sjogren. </p> Index: NHibernateSolution.build =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/NHibernateSolution.build,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** NHibernateSolution.build 27 Dec 2004 22:14:06 -0000 1.21 --- NHibernateSolution.build 27 Dec 2004 23:12:29 -0000 1.22 *************** *** 312,315 **** --- 312,319 ---- <excludes name="**/obj/**" /> + <!-- exclude ReSharper stuff --> + <excludes name="**/_ReSharper*" /> + <excludes name="**/*.resharperoptions" /> + <!-- exclude any keys that exist on the build machine --> <excludes name="**/*.snk" /> |
From: Michael D. <mik...@us...> - 2004-12-27 22:14:17
|
Update of /cvsroot/nhibernate/nhibernate In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12849 Modified Files: NHibernateSolution.build Log Message: Added copy of DynamicProxy in the build target. Index: NHibernateSolution.build =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/NHibernateSolution.build,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** NHibernateSolution.build 8 Dec 2004 15:30:53 -0000 1.20 --- NHibernateSolution.build 27 Dec 2004 22:14:06 -0000 1.21 *************** *** 140,143 **** --- 140,144 ---- --> <excludes name="Iesi.Collections.*" /> + <includes name="Castle.DynamicProxy.*" /> <includes name="log4net.*" /> <includes name="nunit.framework.*" /> |
From: Michael D. <mik...@us...> - 2004-12-27 03:54:02
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Loader In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15968/NHibernate/Loader Modified Files: Loader.cs Log Message: Added a lock inside a method that might be called by multiple threads and modifies a class scoped field. Index: Loader.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Loader/Loader.cs,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** Loader.cs 4 Dec 2004 22:41:21 -0000 1.43 --- Loader.cs 27 Dec 2004 03:53:52 -0000 1.44 *************** *** 3,12 **** using System.Data; - using NHibernate.Cfg; using NHibernate.Collection; using NHibernate.Engine; using NHibernate.Persister; using NHibernate.SqlCommand; - using NHibernate.Transaction; using NHibernate.Type; using NHibernate.Util; --- 3,10 ---- *************** *** 283,287 **** /// </remarks> /// <param name="persister"></param> - /// <param name="suffix"></param> /// <param name="id"></param> /// <param name="rs"></param> --- 281,284 ---- *************** *** 335,339 **** /// <param name="keys"></param> /// <param name="optionalObject"></param> ! /// <param name="optionalobjectKey"></param> /// <param name="session"></param> /// <returns></returns> --- 332,336 ---- /// <param name="keys"></param> /// <param name="optionalObject"></param> ! /// <param name="optionalObjectKey"></param> /// <param name="session"></param> /// <returns></returns> *************** *** 574,581 **** /// </summary> /// <param name="sqlString">The SqlString to convert into a prepared IDbCommand.</param> ! /// <param name="values">The values that should be bound to the parameters in the IDbCommand</param> ! /// <param name="types">The IType for the value</param> ! /// <param name="namedParams">The HQL named parameters.</param> ! /// <param name="selection">The RowSelection to help setup the CommandTimeout</param> /// <param name="scroll">TODO: find out where this is used...</param> /// <param name="session">The SessionImpl this Command is being prepared in.</param> --- 571,575 ---- /// </summary> /// <param name="sqlString">The SqlString to convert into a prepared IDbCommand.</param> ! /// <param name="parameters">The <see cref="QueryParameters"/> to use for the IDbCommand.</param> /// <param name="scroll">TODO: find out where this is used...</param> /// <param name="session">The SessionImpl this Command is being prepared in.</param> |
From: Michael D. <mik...@us...> - 2004-12-27 03:54:02
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Hql In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15968/NHibernate/Hql Modified Files: QueryTranslator.cs Log Message: Added a lock inside a method that might be called by multiple threads and modifies a class scoped field. Index: QueryTranslator.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Hql/QueryTranslator.cs,v retrieving revision 1.50 retrieving revision 1.51 diff -C2 -d -r1.50 -r1.51 *** QueryTranslator.cs 4 Dec 2004 22:41:20 -0000 1.50 --- QueryTranslator.cs 27 Dec 2004 03:53:52 -0000 1.51 *************** *** 4,10 **** using System.Reflection; using System.Runtime.CompilerServices; - using System.Runtime.Serialization; using System.Text; - using System.Text.RegularExpressions; using Iesi.Collections; --- 4,8 ---- *************** *** 72,75 **** --- 70,83 ---- private bool compiled; //protected private SqlCommand.SqlString sqlString; + + /// <summary> + /// Indicates if the SqlString has been fully populated - it goes + /// through a 2 phase process. The first part is the parsing of the + /// hql and it puts in placeholders for the parameters, the second phase + /// puts in the actual types for the parameters. The completion of + /// the second phase is when <c>isSqlStringPopulated==true</c>. + /// </summary> + private bool isSqlStringPopulated; + private System.Type holderClass; private ConstructorInfo holderConstructor; *************** *** 1237,1240 **** --- 1245,1250 ---- } + private object prepareCommandLock = new object(); + /// <summary> /// Creates an IDbCommand object and populates it with the values necessary to execute it against the *************** *** 1254,1364 **** protected override IDbCommand PrepareCommand(SqlString sqlString, QueryParameters parameters, bool scroll, ISessionImplementor session) { ! SqlString sql = null; ! ! // when there is no untyped Parameters then we can avoid the need to create ! // a new sql string and just return the existing one because it is ready ! // to be prepared and executed. ! if(sqlString.ContainsUntypedParameter==false) ! { ! sql = sqlString; ! } ! else { ! // holds the index of the sqlPart that should be replaced ! int sqlPartIndex = 0; ! ! // holds the index of the paramIndexes array that is the current position ! int paramIndex = 0; ! sql = sqlString.Clone(); ! int[] paramIndexes = sql.ParameterIndexes; ! // if there are no Parameters in the SqlString then there is no reason to ! // bother with this code. ! if( paramIndexes.Length > 0 ) ! { ! ! for( int i=0; i<parameters.PositionalParameterTypes.Length; i++ ) ! { ! string[] colNames = new string[ parameters.PositionalParameterTypes[i].GetColumnSpan(factory)]; ! for( int j=0; j<colNames.Length; j++ ) ! { ! colNames[j] = "p" + paramIndex.ToString() + j.ToString(); ! } ! Parameter[] sqlParameters = Parameter.GenerateParameters( factory, colNames , parameters.PositionalParameterTypes[i] ); ! foreach(Parameter param in sqlParameters) { - sqlPartIndex = paramIndexes[paramIndex]; - sql.SqlParts[sqlPartIndex] = param; ! paramIndex++; ! } ! } ! if( parameters.NamedParameters!=null && parameters.NamedParameters.Count > 0 ) ! { ! // convert the named parameters to an array of types ! ArrayList paramTypeList = new ArrayList(); ! ! foreach( DictionaryEntry e in parameters.NamedParameters ) ! { ! string name = (string) e.Key; ! TypedValue typedval = (TypedValue) e.Value; ! int[] locs = GetNamedParameterLocs(name); ! for( int i=0; i<locs.Length; i++ ) ! { ! int lastInsertedIndex = paramTypeList.Count; ! int insertAt = locs[i]; ! // need to make sure that the ArrayList is populated with null objects ! // up to the index we are about to add the values into. An Index Out ! // of Range exception will be thrown if we add an element at an index ! // that is greater than the Count. ! if(insertAt >= lastInsertedIndex) { ! for(int j=lastInsertedIndex; j<=insertAt; j++) { ! paramTypeList.Add(null); } } - - paramTypeList[insertAt] = typedval.Type; - } - } ! for( int i=0; i<paramTypeList.Count; i++ ) ! { ! IType type = (IType)paramTypeList[i]; ! string[] colNames = new string[type.GetColumnSpan(factory)]; ! for( int j=0; j<colNames.Length; j++ ) ! { ! colNames[j] = "p" + paramIndex.ToString() + j.ToString(); ! } ! Parameter[] sqlParameters = Parameter.GenerateParameters( factory, colNames , type ); ! foreach(Parameter param in sqlParameters) ! { ! sqlPartIndex = paramIndexes[paramIndex]; ! sql.SqlParts[sqlPartIndex] = param; ! ! paramIndex++; } } } } } ! // replace the local field used by the SqlString property with the one we just built ! // that has the correct parameters ! this.sqlString = sql; ! ! return base.PrepareCommand(sql, parameters, scroll, session); } } --- 1264,1381 ---- protected override IDbCommand PrepareCommand(SqlString sqlString, QueryParameters parameters, bool scroll, ISessionImplementor session) { ! lock( prepareCommandLock ) { + if( !isSqlStringPopulated ) + { + SqlString sql = null; ! // when there is no untyped Parameters then we can avoid the need to create ! // a new sql string and just return the existing one because it is ready ! // to be prepared and executed. ! if(sqlString.ContainsUntypedParameter==false) ! { ! sql = sqlString; ! } ! else ! { ! // holds the index of the sqlPart that should be replaced ! int sqlPartIndex = 0; ! // holds the index of the paramIndexes array that is the current position ! int paramIndex = 0; ! sql = sqlString.Clone(); ! int[] paramIndexes = sql.ParameterIndexes; ! // if there are no Parameters in the SqlString then there is no reason to ! // bother with this code. ! if( paramIndexes.Length > 0 ) { ! for( int i=0; i<parameters.PositionalParameterTypes.Length; i++ ) ! { ! string[] colNames = new string[ parameters.PositionalParameterTypes[i].GetColumnSpan(factory)]; ! for( int j=0; j<colNames.Length; j++ ) ! { ! colNames[j] = "p" + paramIndex.ToString() + j.ToString(); ! } ! Parameter[] sqlParameters = Parameter.GenerateParameters( factory, colNames , parameters.PositionalParameterTypes[i] ); ! foreach(Parameter param in sqlParameters) ! { ! sqlPartIndex = paramIndexes[paramIndex]; ! sql.SqlParts[sqlPartIndex] = param; ! ! paramIndex++; ! } ! } ! if( parameters.NamedParameters!=null && parameters.NamedParameters.Count > 0 ) ! { ! // convert the named parameters to an array of types ! ArrayList paramTypeList = new ArrayList(); ! foreach( DictionaryEntry e in parameters.NamedParameters ) { ! string name = (string) e.Key; ! TypedValue typedval = (TypedValue) e.Value; ! int[] locs = GetNamedParameterLocs(name); ! ! for( int i=0; i<locs.Length; i++ ) { ! int lastInsertedIndex = paramTypeList.Count; ! ! int insertAt = locs[i]; ! ! // need to make sure that the ArrayList is populated with null objects ! // up to the index we are about to add the values into. An Index Out ! // of Range exception will be thrown if we add an element at an index ! // that is greater than the Count. ! if(insertAt >= lastInsertedIndex) ! { ! for(int j=lastInsertedIndex; j<=insertAt; j++) ! { ! paramTypeList.Add(null); ! } ! } ! ! paramTypeList[insertAt] = typedval.Type; } } ! for( int i=0; i<paramTypeList.Count; i++ ) ! { ! IType type = (IType)paramTypeList[i]; ! string[] colNames = new string[type.GetColumnSpan(factory)]; ! for( int j=0; j<colNames.Length; j++ ) ! { ! colNames[j] = "p" + paramIndex.ToString() + j.ToString(); ! } ! Parameter[] sqlParameters = Parameter.GenerateParameters( factory, colNames , type ); ! foreach(Parameter param in sqlParameters) ! { ! sqlPartIndex = paramIndexes[paramIndex]; ! sql.SqlParts[sqlPartIndex] = param; ! ! paramIndex++; ! } ! } } } } + + // replace the local field used by the SqlString property with the one we just built + // that has the correct parameters + this.sqlString = sql; + isSqlStringPopulated = true; } } ! return base.PrepareCommand( this.sqlString, parameters, scroll, session ); } } |
From: Michael D. <mik...@us...> - 2004-12-27 02:27:37
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Tool/hbm2ddl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3965/NHibernate/Tool/hbm2ddl Modified Files: SchemaExport.cs Log Message: Fixed exception rethrow so it doesn't lose original exception. Index: SchemaExport.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Tool/hbm2ddl/SchemaExport.cs,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** SchemaExport.cs 20 Aug 2004 02:00:20 -0000 1.11 --- SchemaExport.cs 27 Dec 2004 02:27:28 -0000 1.12 *************** *** 213,217 **** { Console.Write(e.StackTrace); ! throw new HibernateException( e.Message ); } finally --- 213,217 ---- { Console.Write(e.StackTrace); ! throw new HibernateException( e.Message, e ); } finally |