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));
 }
Beispiel #2
0
 	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 void LinqResultTransformer_ShouldHaveEqualityBasedOnCtorParameter()
		{
			Func<object[], object> d1 = x => new object();
			Func<IEnumerable<object>, IEnumerable<object>> d2 = x => x;
			var transformer1 = new ResultTransformer(d1, d2);
			var transformer2 = new ResultTransformer(d1, d2);
			transformer1.Should().Be.EqualTo(transformer2);
			transformer1.GetHashCode().Should().Be.EqualTo(transformer2.GetHashCode());

			Func<IEnumerable<object>, IEnumerable<int>> d3 = x => new [] { 1, 2, 3 };
			var transformer3 = new ResultTransformer(d1, d3);
			transformer1.Should().Not.Be.EqualTo(transformer3);
			transformer1.GetHashCode().Should().Not.Be.EqualTo(transformer3.GetHashCode());
		}
		public void LinqResultTransformer_ShouldHaveEqualityBasedOnCtorParameter()
		{
			DoNothingDelegate d1 = () => { };
			DoNothingDelegate d2 = () => { };
			var transformer1 = new ResultTransformer(d1, d2);
			var transformer2 = new ResultTransformer(d1, d2);
			transformer1.Should().Be.EqualTo(transformer2);
			transformer1.GetHashCode().Should().Be.EqualTo(transformer2.GetHashCode());

			DoNothingDelegate1 d3 = () => { };
			var transformer3 = new ResultTransformer(d1, d3);
			transformer1.Should().Not.Be.EqualTo(transformer3);
			transformer1.GetHashCode().Should().Not.Be.EqualTo(transformer3.GetHashCode());
		}
Beispiel #5
0
        public ExpressionToHqlTranslationResults(HqlTreeNode statement,
                                                 IList <LambdaExpression> itemTransformers,
                                                 IList <LambdaExpression> listTransformers,
                                                 IList <LambdaExpression> postExecuteTransformers,
                                                 List <Action <IQuery, IDictionary <string, Tuple <object, IType> > > > additionalCriteria)
        {
            Statement = statement;

            PostExecuteTransformer = MergeLambdasAndCompile(postExecuteTransformers);

            var itemTransformer = MergeLambdasAndCompile <Func <object[], object> >(itemTransformers);
            var listTransformer = MergeLambdasAndCompile <Func <IEnumerable <object>, object> >(listTransformers);

            if (itemTransformer != null || listTransformer != null)
            {
                ResultTransformer = new ResultTransformer(itemTransformer, listTransformer);
            }

            AdditionalCriteria = additionalCriteria;
        }
        public ExpressionToHqlTranslationResults(HqlTreeNode statement, 
            IList<LambdaExpression> itemTransformers, 
            IList<LambdaExpression> listTransformers,
            IList<LambdaExpression> postExecuteTransformers,
            List<Action<IQuery, IDictionary<string, Tuple<object, IType>>>> additionalCriteria)
        {
            Statement = statement;

            PostExecuteTransformer = MergeLambdasAndCompile(postExecuteTransformers);

            var itemTransformer = MergeLambdasAndCompile(itemTransformers);
            var listTransformer = MergeLambdasAndCompile(listTransformers);

            if (itemTransformer != null || listTransformer != null)
            {
                 ResultTransformer = new ResultTransformer(itemTransformer, listTransformer);
            }

        	AdditionalCriteria = additionalCriteria;
        }