From: <ste...@us...> - 2009-09-03 17:16:05
|
Revision: 4706 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4706&view=rev Author: steverstrong Date: 2009-09-03 17:15:55 +0000 (Thu, 03 Sep 2009) Log Message: ----------- Added serializable attribute Modified Paths: -------------- trunk/nhibernate/src/NHibernate/Linq/ResultTransformer.cs Modified: trunk/nhibernate/src/NHibernate/Linq/ResultTransformer.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Linq/ResultTransformer.cs 2009-09-03 14:41:28 UTC (rev 4705) +++ trunk/nhibernate/src/NHibernate/Linq/ResultTransformer.cs 2009-09-03 17:15:55 UTC (rev 4706) @@ -5,6 +5,7 @@ namespace NHibernate.Linq { + [Serializable] public class ResultTransformer : IResultTransformer { private readonly LambdaExpression _expression; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fab...@us...> - 2011-05-20 14:32:04
|
Revision: 5842 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5842&view=rev Author: fabiomaulo Date: 2011-05-20 14:31:58 +0000 (Fri, 20 May 2011) Log Message: ----------- Minor (reformatted) Modified Paths: -------------- trunk/nhibernate/src/NHibernate/Linq/ResultTransformer.cs Modified: trunk/nhibernate/src/NHibernate/Linq/ResultTransformer.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Linq/ResultTransformer.cs 2011-05-20 13:58:52 UTC (rev 5841) +++ trunk/nhibernate/src/NHibernate/Linq/ResultTransformer.cs 2011-05-20 14:31:58 UTC (rev 5842) @@ -5,85 +5,86 @@ namespace NHibernate.Linq { - [Serializable] - public class ResultTransformer : IResultTransformer - { - private readonly Delegate _listTransformation; - private readonly Delegate _itemTransformation; + [Serializable] + public class ResultTransformer : IResultTransformer + { + private readonly Delegate _itemTransformation; + private readonly Delegate _listTransformation; - public ResultTransformer(Delegate itemTransformation, Delegate listTransformation) - { - _itemTransformation = itemTransformation; - _listTransformation = listTransformation; - } + public ResultTransformer(Delegate itemTransformation, Delegate listTransformation) + { + _itemTransformation = itemTransformation; + _listTransformation = listTransformation; + } - public object TransformTuple(object[] tuple, string[] aliases) - { - return _itemTransformation == null ? tuple : _itemTransformation.DynamicInvoke(new object[] { tuple } ); - } + #region IResultTransformer Members - public IList TransformList(IList collection) - { - if (_listTransformation == null) - { - return collection; - } + public object TransformTuple(object[] tuple, string[] aliases) + { + return _itemTransformation == null ? tuple : _itemTransformation.DynamicInvoke(new object[] {tuple}); + } - object transformResult = collection; + public IList TransformList(IList collection) + { + if (_listTransformation == null) + { + return collection; + } - //if (collection.Count > 0) - { - if (collection.Count > 0 && collection[0] is object[]) - { - if ( ((object[])collection[0]).Length != 1) - { - // We only expect single items - throw new NotSupportedException(); - } + object transformResult = collection; - transformResult = _listTransformation.DynamicInvoke(collection.Cast<object[]>().Select(o => o[0])); - } - else - { - transformResult = _listTransformation.DynamicInvoke(collection); - } - } + if (collection.Count > 0 && collection[0] is object[]) + { + if (((object[]) collection[0]).Length != 1) + { + // We only expect single items + throw new NotSupportedException(); + } - if (transformResult is IList) - { - return (IList) transformResult; - } + transformResult = _listTransformation.DynamicInvoke(collection.Cast<object[]>().Select(o => o[0])); + } + else + { + transformResult = _listTransformation.DynamicInvoke(collection); + } - var list = new ArrayList {transformResult}; - return list; - } + if (transformResult is IList) + { + return (IList) transformResult; + } - public bool Equals(ResultTransformer other) - { - if (ReferenceEquals(null, other)) - { - return false; - } - if (ReferenceEquals(this, other)) - { - return true; - } - return Equals(other._listTransformation, _listTransformation) && Equals(other._itemTransformation, _itemTransformation); - } + var list = new ArrayList {transformResult}; + return list; + } - public override bool Equals(object obj) - { - return Equals(obj as ResultTransformer); - } + #endregion - public override int GetHashCode() - { - unchecked - { - var lt = (_listTransformation != null ? _listTransformation.GetHashCode() : 0); - var it = (_itemTransformation != null ? _itemTransformation.GetHashCode() : 0); - return (lt * 397) ^ (it * 17); - } - } - } + public bool Equals(ResultTransformer other) + { + if (ReferenceEquals(null, other)) + { + return false; + } + if (ReferenceEquals(this, other)) + { + return true; + } + return Equals(other._listTransformation, _listTransformation) && Equals(other._itemTransformation, _itemTransformation); + } + + public override bool Equals(object obj) + { + return Equals(obj as ResultTransformer); + } + + public override int GetHashCode() + { + unchecked + { + int lt = (_listTransformation != null ? _listTransformation.GetHashCode() : 0); + int it = (_itemTransformation != null ? _itemTransformation.GetHashCode() : 0); + return (lt*397) ^ (it*17); + } + } + } } \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fab...@us...> - 2011-05-20 15:08:17
|
Revision: 5844 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5844&view=rev Author: fabiomaulo Date: 2011-05-20 15:08:10 +0000 (Fri, 20 May 2011) Log Message: ----------- Minor refactoring Modified Paths: -------------- trunk/nhibernate/src/NHibernate/Linq/ResultTransformer.cs Modified: trunk/nhibernate/src/NHibernate/Linq/ResultTransformer.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Linq/ResultTransformer.cs 2011-05-20 15:00:09 UTC (rev 5843) +++ trunk/nhibernate/src/NHibernate/Linq/ResultTransformer.cs 2011-05-20 15:08:10 UTC (rev 5844) @@ -45,7 +45,7 @@ } else { - toTransform = collection.Cast<object>().ToList(); + toTransform = collection.Cast<object>(); } object transformResult = _listTransformation.DynamicInvoke(toTransform); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |