Created
November 14, 2009 21:27
-
-
Save jfromaniello/234794 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//USAGE: | |
.SetResultTransformer(new DelegateTransformer<SomeNoSeQue>(m => new SomeNoSeQue((int)m[0],(string)m[1]){ Algo = m[3] }); | |
[Serializable] | |
public class DelegateTransformer<TEntity> : IResultTransformer | |
{ | |
private readonly Func<object[], TEntity> _transformFucntion; | |
public DelegateTransformer(Func<object[], TEntity> transformFucntion) | |
{ | |
_transformFucntion = transformFucntion; | |
} | |
#region IResultTransformer Members | |
public IList TransformList(IList collection) | |
{ | |
return collection; | |
} | |
public object TransformTuple(object[] tuple, string[] aliases) | |
{ | |
return _transformFucntion(tuple); | |
} | |
#endregion | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment