From: Kevin W. <kev...@us...> - 2004-12-31 18:56:49
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Id In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2243 Modified Files: GuidCombGenerator.cs GuidGenerator.cs IConfigurable.cs Log Message: fixing xml comments and letting ReSharper do reformatting Index: IConfigurable.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Id/IConfigurable.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** IConfigurable.cs 28 Mar 2004 06:06:40 -0000 1.2 --- IConfigurable.cs 31 Dec 2004 18:56:22 -0000 1.3 *************** *** 1,13 **** - using System; using System.Collections; using NHibernate.Type; ! namespace NHibernate.Id { - /// <summary> /// An <c>IdentiferGenerator</c> that supports "configuration". /// </summary> ! public interface IConfigurable { /// <summary> --- 1,11 ---- using System.Collections; using NHibernate.Type; ! namespace NHibernate.Id { /// <summary> /// An <c>IdentiferGenerator</c> that supports "configuration". /// </summary> ! public interface IConfigurable { /// <summary> *************** *** 19,23 **** /// <param name="parms">Param values that are keyed by parameter name.</param> /// <param name="d"></param> ! void Configure(IType type, IDictionary parms, Dialect.Dialect d); } ! } --- 17,21 ---- /// <param name="parms">Param values that are keyed by parameter name.</param> /// <param name="d"></param> ! void Configure( IType type, IDictionary parms, Dialect.Dialect d ); } ! } \ No newline at end of file Index: GuidCombGenerator.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Id/GuidCombGenerator.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** GuidCombGenerator.cs 11 Oct 2004 23:57:54 -0000 1.1 --- GuidCombGenerator.cs 31 Dec 2004 18:56:22 -0000 1.2 *************** *** 14,54 **** public class GuidCombGenerator : IIdentifierGenerator { - #region IIdentifierGenerator Members ! public object Generate(ISessionImplementor session, object obj) { return GenerateComb(); } private Guid GenerateComb() { ! byte[] guidArray = System.Guid.NewGuid().ToByteArray(); ! DateTime baseDate = new DateTime(1900,1,1); ! DateTime now = DateTime.Now; // Get the days and milliseconds which will be used to build the byte string ! TimeSpan days = new TimeSpan(now.Ticks - baseDate.Ticks); ! TimeSpan msecs = new TimeSpan(now.Ticks - (new DateTime(now.Year, now.Month, now.Day).Ticks)); // Convert to a byte array // Note that SQL Server is accurate to 1/300th of a millisecond so we divide by 3.333333 ! byte[] daysArray = BitConverter.GetBytes(days.Days); ! byte[] msecsArray = BitConverter.GetBytes((long)(msecs.TotalMilliseconds/3.333333)); // Reverse the bytes to match SQL Servers ordering ! Array.Reverse(daysArray); ! Array.Reverse(msecsArray); // Copy the bytes into the guid ! Array.Copy(daysArray, daysArray.Length - 2, guidArray, guidArray.Length - 6, 2); ! Array.Copy(msecsArray, msecsArray.Length - 4, guidArray, guidArray.Length - 4, 4); ! return new Guid(guidArray); } - #endregion } ! } --- 14,59 ---- public class GuidCombGenerator : IIdentifierGenerator { #region IIdentifierGenerator Members ! /// <summary> ! /// ! /// </summary> ! /// <param name="session"></param> ! /// <param name="obj"></param> ! /// <returns></returns> ! public object Generate( ISessionImplementor session, object obj ) { return GenerateComb(); } + /// <summary></summary> private Guid GenerateComb() { ! byte[ ] guidArray = Guid.NewGuid().ToByteArray(); ! DateTime baseDate = new DateTime( 1900, 1, 1 ); ! DateTime now = DateTime.Now; // Get the days and milliseconds which will be used to build the byte string ! TimeSpan days = new TimeSpan( now.Ticks - baseDate.Ticks ); ! TimeSpan msecs = new TimeSpan( now.Ticks - ( new DateTime( now.Year, now.Month, now.Day ).Ticks ) ); // Convert to a byte array // Note that SQL Server is accurate to 1/300th of a millisecond so we divide by 3.333333 ! byte[ ] daysArray = BitConverter.GetBytes( days.Days ); ! byte[ ] msecsArray = BitConverter.GetBytes( ( long ) ( msecs.TotalMilliseconds/3.333333 ) ); // Reverse the bytes to match SQL Servers ordering ! Array.Reverse( daysArray ); ! Array.Reverse( msecsArray ); // Copy the bytes into the guid ! Array.Copy( daysArray, daysArray.Length - 2, guidArray, guidArray.Length - 6, 2 ); ! Array.Copy( msecsArray, msecsArray.Length - 4, guidArray, guidArray.Length - 4, 4 ); ! return new Guid( guidArray ); } #endregion } ! } \ No newline at end of file Index: GuidGenerator.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Id/GuidGenerator.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** GuidGenerator.cs 28 Mar 2004 06:06:40 -0000 1.1 --- GuidGenerator.cs 31 Dec 2004 18:56:22 -0000 1.2 *************** *** 1,7 **** using System; - using NHibernate.Engine; - namespace NHibernate.Id { --- 1,5 ---- *************** *** 11,18 **** public class GuidGenerator : IIdentifierGenerator { - #region IIdentifierGenerator Members ! public object Generate(ISessionImplementor session, object obj) { return Guid.NewGuid(); --- 9,21 ---- public class GuidGenerator : IIdentifierGenerator { #region IIdentifierGenerator Members ! /// <summary> ! /// ! /// </summary> ! /// <param name="session"></param> ! /// <param name="obj"></param> ! /// <returns></returns> ! public object Generate( ISessionImplementor session, object obj ) { return Guid.NewGuid(); *************** *** 21,23 **** #endregion } ! } --- 24,26 ---- #endregion } ! } \ No newline at end of file |