From: Kevin W. <kev...@us...> - 2004-12-31 18:58:38
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Id In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2467 Modified Files: UUIDHexGenerator.cs UUIDStringGenerator.cs Log Message: fixing xml comments and letting ReSharper do reformatting Index: UUIDStringGenerator.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Id/UUIDStringGenerator.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** UUIDStringGenerator.cs 28 Mar 2004 06:06:40 -0000 1.3 --- UUIDStringGenerator.cs 31 Dec 2004 18:58:24 -0000 1.4 *************** *** 3,7 **** using NHibernate.Engine; ! namespace NHibernate.Id { /// <summary> --- 3,7 ---- using NHibernate.Engine; ! namespace NHibernate.Id { /// <summary> *************** *** 18,35 **** /// </para> /// </remarks> ! public class UUIDStringGenerator : IIdentifierGenerator { ! ! public object Generate(ISessionImplementor cache, object obj) { ! byte[] guidInBytes = new byte[16]; ! StringBuilder guidBuilder = new StringBuilder(16, 16); guidInBytes = Guid.NewGuid().ToByteArray(); // add each item in Byte[] to the string builder ! for(int i = 0; i < guidInBytes.Length; i++) { ! guidBuilder.Append((char)guidInBytes[i]); } --- 18,40 ---- /// </para> /// </remarks> ! public class UUIDStringGenerator : IIdentifierGenerator { ! /// <summary> ! /// ! /// </summary> ! /// <param name="cache"></param> ! /// <param name="obj"></param> ! /// <returns></returns> ! public object Generate( ISessionImplementor cache, object obj ) { ! byte[ ] guidInBytes = new byte[16]; ! StringBuilder guidBuilder = new StringBuilder( 16, 16 ); guidInBytes = Guid.NewGuid().ToByteArray(); // add each item in Byte[] to the string builder ! for( int i = 0; i < guidInBytes.Length; i++ ) { ! guidBuilder.Append( ( char ) guidInBytes[ i ] ); } *************** *** 37,39 **** } } ! } --- 42,44 ---- } } ! } \ No newline at end of file Index: UUIDHexGenerator.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Id/UUIDHexGenerator.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** UUIDHexGenerator.cs 28 Mar 2004 06:06:40 -0000 1.1 --- UUIDHexGenerator.cs 31 Dec 2004 18:58:24 -0000 1.2 *************** *** 1,5 **** using System; using System.Collections; ! using NHibernate.Engine; using NHibernate.Type; --- 1,5 ---- using System; using System.Collections; ! using log4net; using NHibernate.Engine; using NHibernate.Type; *************** *** 24,28 **** /// <para> /// <c>format</c> is either "N", "D", "B", or "P". These formats are described in ! /// the <see cref="System.Guid.ToString(String)">Guid.ToString(String)</see> method. /// If no <c>format</c> is specified the default is "N". /// </para> --- 24,28 ---- /// <para> /// <c>format</c> is either "N", "D", "B", or "P". These formats are described in ! /// the <see cref="System.Guid.ToString(string)">Guid.ToString(String)</see> method. /// If no <c>format</c> is specified the default is "N". /// </para> *************** *** 37,47 **** /// </para> /// </remarks> ! public class UUIDHexGenerator : IIdentifierGenerator, IConfigurable { ! private static readonly log4net.ILog log = log4net.LogManager.GetLogger(typeof(UUIDHexGenerator)); private string format = FormatWithDigitsOnly; private string sep = null; ! //"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" private const string FormatWithDigitsOnly = "N"; --- 37,47 ---- /// </para> /// </remarks> ! public class UUIDHexGenerator : IIdentifierGenerator, IConfigurable { ! private static readonly ILog log = LogManager.GetLogger( typeof( UUIDHexGenerator ) ); private string format = FormatWithDigitsOnly; private string sep = null; ! //"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" private const string FormatWithDigitsOnly = "N"; *************** *** 53,81 **** private const string FormatWithEnclosingParens = "P"; ! public object Generate(ISessionImplementor cache, object obj) { ! string guidString = Guid.NewGuid().ToString(format); ! if(format!=FormatWithDigitsOnly && sep!=null) { ! return StringHelper.Replace(guidString, "-", sep); } ! return guidString; } - #region IConfigurable Members ! public void Configure(IType type, IDictionary parms, Dialect.Dialect dialect) { ! format = PropertiesHelper.GetString("format", parms, FormatWithDigitsOnly); ! ! if(format!=FormatWithDigitsOnly) ! sep = PropertiesHelper.GetString("seperator", parms, null); ! } #endregion } ! } --- 53,94 ---- private const string FormatWithEnclosingParens = "P"; ! /// <summary> ! /// ! /// </summary> ! /// <param name="cache"></param> ! /// <param name="obj"></param> ! /// <returns></returns> ! public object Generate( ISessionImplementor cache, object obj ) { ! string guidString = Guid.NewGuid().ToString( format ); ! if( format != FormatWithDigitsOnly && sep != null ) { ! return StringHelper.Replace( guidString, "-", sep ); } ! return guidString; } #region IConfigurable Members ! /// <summary> ! /// ! /// </summary> ! /// <param name="type"></param> ! /// <param name="parms"></param> ! /// <param name="dialect"></param> ! public void Configure( IType type, IDictionary parms, Dialect.Dialect dialect ) { ! format = PropertiesHelper.GetString( "format", parms, FormatWithDigitsOnly ); ! ! if( format != FormatWithDigitsOnly ) ! { ! sep = PropertiesHelper.GetString( "seperator", parms, null ); ! } ! } #endregion } ! } \ No newline at end of file |