TinyMapper v2.1.4-beta Release Notes

Release Date: 2017-08-18 // almost 5 years ago
    • ➕ 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);