Update of /cvsroot/nhibernate/NHibernateContrib/src/NHibernate.Tool.Net2Hbm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5742/src/NHibernate.Tool.Net2Hbm
Modified Files:
MapGenerator.cs NHibernate.Tool.Net2Hbm-1.1.csproj
Added Files:
GeneratorParameterAttribute.cs
Log Message:
Added the generator parameter attribute to support generator params on the id tag.
Index: MapGenerator.cs
===================================================================
RCS file: /cvsroot/nhibernate/NHibernateContrib/src/NHibernate.Tool.Net2Hbm/MapGenerator.cs,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** MapGenerator.cs 11 Feb 2005 22:54:01 -0000 1.2
--- MapGenerator.cs 13 Feb 2005 01:32:12 -0000 1.3
***************
*** 497,500 ****
--- 497,501 ----
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" );
***************
*** 510,513 ****
--- 511,515 ----
writer.WriteStartElement("generator");
writer.WriteAttributeString( "class", GetShortTypeName( attribute.Generator ) );
+ WriteGeneratorParameters( writer, property );
writer.WriteEndElement(); //</generator>
writer.WriteEndElement(); //</id>
***************
*** 515,518 ****
--- 517,537 ----
/// <summary>
+ /// Writes the generator parameters.
+ /// </summary>
+ /// <param name="writer"></param>
+ /// <param name="property"></param>
+ private void WriteGeneratorParameters( XmlWriter writer, PropertyInfo property )
+ {
+ GeneratorParameterAttribute[] attributes = (GeneratorParameterAttribute[])Attribute.GetCustomAttributes( property, typeof(GeneratorParameterAttribute), true );
+ foreach( GeneratorParameterAttribute attribute in attributes )
+ {
+ writer.WriteStartElement( "param" );
+ writer.WriteAttributeString( "name", attribute.Name );
+ writer.WriteString( attribute.Value );
+ writer.WriteEndElement(); //</param>
+ }
+ }
+
+ /// <summary>
/// Writes the joined subclass.
/// </summary>
Index: NHibernate.Tool.Net2Hbm-1.1.csproj
===================================================================
RCS file: /cvsroot/nhibernate/NHibernateContrib/src/NHibernate.Tool.Net2Hbm/NHibernate.Tool.Net2Hbm-1.1.csproj,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** NHibernate.Tool.Net2Hbm-1.1.csproj 11 Feb 2005 22:54:01 -0000 1.3
--- NHibernate.Tool.Net2Hbm-1.1.csproj 13 Feb 2005 01:32:12 -0000 1.4
***************
*** 135,138 ****
--- 135,143 ----
/>
<File
+ RelPath = "GeneratorParameterAttribute.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
RelPath = "IdAttribute.cs"
SubType = "Code"
--- NEW FILE: GeneratorParameterAttribute.cs ---
#region Copyright (c) 2004 Schwab Performance Technologies, Inc. All rights reserved.
/* ============================================================================
// $Header: /cvsroot/nhibernate/NHibernateContrib/src/NHibernate.Tool.Net2Hbm/GeneratorParameterAttribute.cs,v 1.1 2005/02/13 01:32:12 johntmorris Exp $
//
// Copyright (c) 2004 Schwab Performance Technologies, Inc. All rights reserved.
//
// Purpose: [To be filled in.]
//
// $Log: GeneratorParameterAttribute.cs,v $
// Revision 1.1 2005/02/13 01:32:12 johntmorris
// Added the generator parameter attribute to support generator params on the id tag.
//
//
// $NoKeywords: $
// ========================================================================= */
#endregion
using System;
namespace NHibernate.Tool.Net2Hbm
{
/// <summary>
/// Summary description for GeneratorParameterAttribute.
/// </summary>
[AttributeUsage(AttributeTargets.Property, AllowMultiple=true)]
public class GeneratorParameterAttribute : Attribute
{
#region Member Variables
private string m_Name;
private string m_Value;
#endregion
/// <summary>
/// Class constructor.
/// </summary>
public GeneratorParameterAttribute( string name, string value )
{
m_Name = name;
m_Value = value;
}
/// <summary>
/// Gets and sets the Name.
/// </summary>
public string Name
{
get { return m_Name; }
set { m_Name = value; }
}
/// <summary>
/// Gets and sets the Value.
/// </summary>
public string Value
{
get { return m_Value; }
set { m_Value = value; }
}
}
}
|