Skip to content

Releases: TinyMapper/TinyMapper

3.0.3

08 Dec 03:48
Compare
Choose a tag to compare
updated version

Add new Map method

07 Jun 16:41
Compare
Choose a tag to compare
Add new Map method Pre-release
Pre-release

added: public static object Map(Type sourceType, Type targetType, object source, object target = null)

Thanks to: izaruba

fixed static fields mapping

25 Oct 17:07
Compare
Choose a tag to compare
Pre-release
    public class MapWithStaticFields
    {
        [Fact]
        public void MapStaticFields()
        {
            var source = new SourceStatic();

            TinyMapper.Bind<SourceStatic, TargetDto>();
            var actual = TinyMapper.Map<TargetDto>(source);

            Assert.Equal(SourceStatic.Id, actual.Id);
            Assert.Equal(SourceStatic.Name, actual.Name);
        }
    }

    public class SourceStatic
    {
        public static string Name = "test";
        public static int Id = 1;
    }


    public class TargetDto
    {
        public int Id { get; set; }
        public string Name { get; set; }
    }

Thanks to Summitn

Version 2.1.4-beta

18 Aug 17:25
Compare
Choose a tag to compare
  • added support supports circular reference mapping

Thanks to: sergiorykov, xihu69

            var source = new Node
            {
                Id = "1",
                Next = new Node
                {
                    Id = "2",
                    Next = new Node
                    {
                        Id = "3",
                        Child = new[]
                        {
                            new Node
                            {
                                Id = " 123 1"
                            },
                            new Node
                            {
                                Id = "123 2"
                            }
                        }

                    }
                },
                Child = new[]
                {
                    new Node
                    {
                        Id = "1 1"
                    },
                    new Node
                    {
                        Id = "1 2"
                    }
                }
            };

            TinyMapper.Bind<Node, Node>();

            var target = TinyMapper.Map<Node, Node>(source);

            Assert.Equal(source.Id, target.Id);
            Assert.Equal(source.Next.Id, target.Next.Id);
            Assert.Equal(source.Next.Next.Id, target.Next.Next.Id);
            Assert.Equal(source.Next.Next.Id, target.Next.Next.Id);

            Assert.Equal(source.Next.Next.Child, target.Next.Next.Child);

            Assert.Equal(source.Child, target.Child);

Version 2.1.3-beta

16 Aug 03:40
Compare
Choose a tag to compare
Version 2.1.3-beta Pre-release
Pre-release
  • Improved mapping, i.e. now it's possible to map properties from other classes source.Address.Street
            TinyMapper.Bind<PersonDto, Person>(
                config =>
                {
                    config.Bind(source => source.Address.Street, target => target.Street);
                    config.Bind(source => source.Address.Phone, target => target.Phone);
                }
            );

Version 2.1.2-beta

14 Aug 16:38
Compare
Choose a tag to compare
Version 2.1.2-beta Pre-release
Pre-release
  • Collection mapping has been improved

Before

Method Mean Error StdDev
CollectionMapping_AutoMapper 27.753 us 0.1789 us 0.1494 us
CollectionMapping_TinyMapper 9.594 us 0.0912 us 0.0853 us
CollectionMapping_Handwritten 3.560 us 0.0709 us 0.0729 us

After

Method Mean Error StdDev
CollectionMapping_AutoMapper 27.696 us 0.5117 us 1.2259 us
CollectionMapping_TinyMapper 6.765 us 0.0660 us 0.0618 us
CollectionMapping_Handwritten 3.521 us 0.0387 us 0.0343 us

Version 2.1.1-beta

13 Aug 05:15
Compare
Choose a tag to compare
Version 2.1.1-beta Pre-release
Pre-release
  • .net standard 1.3
  • Bind is a thread safe
  • Map can be called in parallel to Map methods, but cannot be called in parallel to Bind method
  • Bind is required, i.e. Bind has to be called before Map

Thanks to: nzaugg, Sdzeng

Version 2.0.8

03 Dec 07:04
Compare
Choose a tag to compare

fixed: DeepCloneable member binding with custom mapping

Thanks to: Gaclaudiu

Version 2.0.6

02 Nov 03:16
Compare
Choose a tag to compare

fixed: Case sensitive binding

Thanks to: Lecamarade

Version 2.0.5

15 Sep 21:39
Compare
Choose a tag to compare

TinyMapper allows to set concrete type if required, i.e.

public class Source
{
    public IList<int> Ints { get; set; }
    public List<string> Strings { get; set; }
}

public class Target
{
    public List<int> Ints { get; set; }
    public IEnumerable<string> Strings { get; set; }
}

TinyMapper.Bind<Source, Target>(config =>
{
    config.Bind(target => target.Strings, typeof(List<string>));
});

Thanks to: Teknogecko, oryol