From: <fab...@us...> - 2009-11-22 15:18:04
|
Revision: 4853 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4853&view=rev Author: fabiomaulo Date: 2009-11-22 15:17:52 +0000 (Sun, 22 Nov 2009) Log Message: ----------- Merge r4852 (refactoring fix NH-2022) Modified Paths: -------------- trunk/nhibernate/src/NHibernate/Criterion/Example.cs Modified: trunk/nhibernate/src/NHibernate/Criterion/Example.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Criterion/Example.cs 2009-11-22 15:14:55 UTC (rev 4852) +++ trunk/nhibernate/src/NHibernate/Criterion/Example.cs 2009-11-22 15:17:52 UTC (rev 4853) @@ -57,9 +57,9 @@ } //private static readonly IPropertySelector NotNull = new NotNullPropertySelector(); - private static readonly IPropertySelector NotNullOrEmptyString = new NotNullOrEmptyStringPropertySelector(); - private static readonly IPropertySelector All = new AllPropertySelector(); - private static readonly IPropertySelector NotNullOrZero = new NotNullOrZeroPropertySelector(); + protected static readonly IPropertySelector NotNullOrEmptyString = new NotNullOrEmptyStringPropertySelector(); + protected static readonly IPropertySelector All = new AllPropertySelector(); + protected static readonly IPropertySelector NotNullOrZero = new NotNullOrZeroPropertySelector(); /// <summary> /// Implementation of <see cref="IPropertySelector"/> that includes all @@ -476,21 +476,22 @@ builder.Add(" and "); } - ICriterion crit; - if (propertyValue != null) - { - bool isString = propertyValue is String; - crit = (_isLikeEnabled && isString) ? - (ICriterion) new LikeExpression(propertyName, propertyValue.ToString(), _matchMode, escapeCharacter, _isIgnoreCaseEnabled) : - new SimpleExpression(propertyName, propertyValue, " = ", _isIgnoreCaseEnabled && isString); - } - else - { - crit = new NullExpression(propertyName); - } + ICriterion crit = propertyValue != null + ? GetNotNullPropertyCriterion(propertyValue, propertyName) + : new NullExpression(propertyName); builder.Add(crit.ToSqlString(criteria, cq, enabledFilters)); } + protected virtual ICriterion GetNotNullPropertyCriterion(object propertyValue, string propertyName) + { + bool isString = propertyValue is string; + return (_isLikeEnabled && isString) + ? (ICriterion) + new LikeExpression(propertyName, propertyValue.ToString(), _matchMode, escapeCharacter, + _isIgnoreCaseEnabled) + : new SimpleExpression(propertyName, propertyValue, " = ", _isIgnoreCaseEnabled && isString); + } + protected void AppendComponentCondition( String path, object component, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |