Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Property
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5010/NHibernate/Property
Modified Files:
PropertyAccessorFactory.cs
Added Files:
LowerCaseUnderscoreStrategy.cs
Log Message:
NH-118 and a refactoring of TestFixture to make it easier to add new
naming strategies for Properties.
Index: PropertyAccessorFactory.cs
===================================================================
RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Property/PropertyAccessorFactory.cs,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** PropertyAccessorFactory.cs 23 Oct 2004 15:01:21 -0000 1.5
--- PropertyAccessorFactory.cs 23 Oct 2004 15:44:09 -0000 1.6
***************
*** 22,28 ****
--- 22,30 ----
accessors["field.camelcase-underscore"] = new FieldAccessor( new CamelCaseUnderscoreStrategy() );
accessors["field.pascalcase-m-underscore"] = new FieldAccessor( new PascalCaseMUnderscoreStrategy() ) ;
+ accessors["field.lowercase-underscore"] = new FieldAccessor( new LowerCaseUnderscoreStrategy() );
accessors["nosetter.camelcase"] = new NoSetterAccessor( new CamelCaseStrategy() );
accessors["nosetter.camelcase-underscore"] = new NoSetterAccessor( new CamelCaseUnderscoreStrategy() );
accessors["nosetter.pascalcase-m-underscore"] = new NoSetterAccessor( new PascalCaseMUnderscoreStrategy() );
+ accessors["nosetter.lowercase-underscore"] = new NoSetterAccessor( new LowerCaseUnderscoreStrategy() );
}
***************
*** 116,123 ****
/// <term>pascalcase-m-underscore</term>
/// <description>
! /// The <c>name</c> attribute should be changed to CamelCase to find the field.
/// <c><property name="Foo" ... ></c> finds a field <c>m_Foo</c>.
/// </description>
/// </item>
/// </list>
/// <para>
--- 118,134 ----
/// <term>pascalcase-m-underscore</term>
/// <description>
! /// The <c>name</c> attribute should be prefixed with an 'm' and underscore
! /// to find the field.
/// <c><property name="Foo" ... ></c> finds a field <c>m_Foo</c>.
/// </description>
/// </item>
+ /// <item>
+ /// <term>lowercase-underscore</term>
+ /// <description>
+ /// The <c>name</c> attribute should be changed to lowercase and prefixed with
+ /// and underscore to find the field.
+ /// <c><property name="FooBar" ... ></c> finds a field <c>_foobar</c>.
+ /// </description>
+ /// </item>
/// </list>
/// <para>
--- NEW FILE: LowerCaseUnderscoreStrategy.cs ---
using System;
namespace NHibernate.Property
{
/// <summary>
/// Implementation of FieldNamingStrategy for fields that are prefixed with
/// an underscore and the PropertyName is changed to lower case.
/// </summary>
public class LowerCaseUnderscoreStrategy : IFieldNamingStrategy
{
#region IFieldNamingStrategy Members
public string GetFieldName(string propertyName)
{
return "_" + propertyName.ToLower();
}
#endregion
}
}
|