Exemplo n.º 1
0
        public void AliasToBeanResultTransformerIsSerializable()
        {
            TestsContext.AssumeSystemTypeIsSerializable();

            var rt = new AliasToBeanResultTransformer(typeof(StudentDTO));

            NHAssert.IsSerializable(rt);
        }
Exemplo n.º 2
0
    public static IQueryOver <TRoot, TSubType> TransformUsingAliasToBean <TRoot, TSubType>(this IQueryOver <TRoot, TSubType> query, Type resultType)
    {
        ITupleSubsetResultTransformer resultTransformer = new AliasToBeanResultTransformer(resultType);
        var criteria = query.UnderlyingCriteria as NHibernate.Impl.CriteriaImpl;

        if (criteria != null)
        {
            resultTransformer = new CacheableAliasToBeenResultTransformer(resultTransformer, criteria.Projection.Aliases);
        }
        return(query.TransformUsing(resultTransformer));
    }
        public void AliasToBeanResultTransformer_ShouldHaveEqualityBasedOnCtorParameter()
        {
            var transformer1 = new AliasToBeanResultTransformer(typeof(object));
            var transformer2 = new AliasToBeanResultTransformer(typeof(object));

            transformer1.Should().Be.EqualTo(transformer2);
            transformer1.GetHashCode().Should().Be.EqualTo(transformer2.GetHashCode());

            var transformer3 = new AliasToBeanResultTransformer(typeof(int));

            transformer1.Should().Not.Be.EqualTo(transformer3);
            transformer1.GetHashCode().Should().Not.Be.EqualTo(transformer3.GetHashCode());
        }
Exemplo n.º 4
0
        public void AliasToBeanResultTransformer_ShouldHaveEqualityBasedOnCtorParameter()
        {
            var transformer1 = new AliasToBeanResultTransformer(typeof(object));
            var transformer2 = new AliasToBeanResultTransformer(typeof(object));

            Assert.That(transformer1, Is.EqualTo(transformer2));
            Assert.That(transformer1.GetHashCode(), Is.EqualTo(transformer2.GetHashCode()));

            var transformer3 = new AliasToBeanResultTransformer(typeof(int));

            Assert.That(transformer1, Is.Not.EqualTo(transformer3));
            Assert.That(transformer1.GetHashCode(), Is.Not.EqualTo(transformer3.GetHashCode()));
        }
Exemplo n.º 5
0
        public void ResultTransformes()
        {
            IResultTransformer rt = new RootEntityResultTransformer();

            NHAssert.IsSerializable(rt);

            rt = new AliasToBeanConstructorResultTransformer(typeof(StudentDTO).GetConstructor(System.Type.EmptyTypes));
            NHAssert.IsSerializable(rt);

            rt = new AliasToBeanResultTransformer(typeof(StudentDTO));
            NHAssert.IsSerializable(rt);

            rt = new DistinctRootEntityResultTransformer();
            NHAssert.IsSerializable(rt);

            rt = new PassThroughResultTransformer();
            NHAssert.IsSerializable(rt);
        }
Exemplo n.º 6
0
        public void AliasToBeanResultTransformerIsSerializable()
        {
            var rt = new AliasToBeanResultTransformer(typeof(StudentDTO));

            NHAssert.IsSerializable(rt);
        }
Exemplo n.º 7
0
 public EntityToModelResultTransformer()
 {
     _innerTransformer = new AliasToBeanResultTransformer(typeof(TTarget));
 }
 public AliasToBeanWithCallbackTransformer(Action <T> callback)
 {
     this.callback = callback;
     this.aliasToBeanTransformer = new AliasToBeanResultTransformer(typeof(T));
 }
Exemplo n.º 9
0
 public AliasToBeanVMFromRecord(Del cb)
 {
     this.aliasToBeanTransformer = new AliasToBeanResultTransformer(typeof(RankingPartRecord));
     _callback = cb;
 }