{"action":"created","issue":{"url":"https://api.github.com/repos/eswann/Mapster/issues/48","repository_url":"https://api.github.com/repos/eswann/Mapster","labels_url":"https://api.github.com/repos/eswann/Mapster/issues/48/labels{/name}","comments_url":"https://api.github.com/repos/eswann/Mapster/issues/48/comments","events_url":"https://api.github.com/repos/eswann/Mapster/issues/48/events","html_url":"https://github.com/eswann/Mapster/issues/48","id":134808780,"number":48,"title":"ForType Settings","user":{"login":"Stalso","id":6276096,"avatar_url":"https://avatars.githubusercontent.com/u/6276096?v=3","gravatar_id":"","url":"https://api.github.com/users/Stalso","html_url":"https://github.com/Stalso","followers_url":"https://api.github.com/users/Stalso/followers","following_url":"https://api.github.com/users/Stalso/following{/other_user}","gists_url":"https://api.github.com/users/Stalso/gists{/gist_id}","starred_url":"https://api.github.com/users/Stalso/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Stalso/subscriptions","organizations_url":"https://api.github.com/users/Stalso/orgs","repos_url":"https://api.github.com/users/Stalso/repos","events_url":"https://api.github.com/users/Stalso/events{/privacy}","received_events_url":"https://api.github.com/users/Stalso/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2016-02-19T08:58:19Z","updated_at":"2016-02-22T12:50:00Z","closed_at":null,"body":"Hello. I have some missunderstanding. I have example code\r\n\r\n        public class SourceClass\r\n        {\r\n            public string A { get; set; }\r\n            public string B { get; set; }\r\n            public string C { get; set; }\r\n        }\r\n        public class DestClass\r\n        {\r\n            public string A { get; set; }\r\n            public string B { get; set; }\r\n            public string C { get; set; }\r\n        }\r\n        private void MappingTest()\r\n        {\r\n            var sourceItem = new SourceClass()\r\n            {\r\n                A = \"A source\",\r\n                B = \"B source\",\r\n                C = \"C source\",\r\n            };\r\n            \r\n            TypeAdapterConfig<SourceClass, DestClass>.NewConfig().Map(dest => dest.A,\r\n              src => string.Format(\"{0} {1}\", src.A, \"Add something To A\"));\r\n\r\n            // This mapping gives:\r\n            // firstResult.A =  \"A source Add something To A\"\r\n            // firstResult.B = \"B\"\r\n            // firstResult.C = \"C\"\r\n            var firstResult = TypeAdapter.Adapt<DestClass>(sourceItem);\r\n\r\n            // This config should extend previous config\r\n            TypeAdapterConfig<SourceClass, DestClass>.ForType().Map(dest => dest.C,\r\n                src => string.Format(\"{0} {1}\", src.C, \"Add something To C\"));\r\n\r\n            // This mapping also gives:\r\n            // secondResult.A = \"A source Add something To A\"\r\n            // secondResult.B = \"B\"\r\n            // secondResult.C = \"C\"\r\n            // But It should give\r\n            // secondResult.A = \"A source Add something To A\"\r\n            // secondResult.B = \"B\"\r\n            // secondResult.C = \"C Add something To C\"\r\n            var secondResult = TypeAdapter.Adapt<DestClass>(sourceItem);\r\n\r\n        }\r\n\r\nAs you see, second `ForType` config is not applied. I resolved this by calling on second (`ForType`) config `Compile()` method. Is it correct? "},"comment":{"url":"https://api.github.com/repos/eswann/Mapster/issues/comments/187157492","html_url":"https://github.com/eswann/Mapster/issues/48#issuecomment-187157492","issue_url":"https://api.github.com/repos/eswann/Mapster/issues/48","id":187157492,"user":{"login":"chaowlert","id":5763993,"avatar_url":"https://avatars.githubusercontent.com/u/5763993?v=3","gravatar_id":"","url":"https://api.github.com/users/chaowlert","html_url":"https://github.com/chaowlert","followers_url":"https://api.github.com/users/chaowlert/followers","following_url":"https://api.github.com/users/chaowlert/following{/other_user}","gists_url":"https://api.github.com/users/chaowlert/gists{/gist_id}","starred_url":"https://api.github.com/users/chaowlert/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chaowlert/subscriptions","organizations_url":"https://api.github.com/users/chaowlert/orgs","repos_url":"https://api.github.com/users/chaowlert/repos","events_url":"https://api.github.com/users/chaowlert/events{/privacy}","received_events_url":"https://api.github.com/users/chaowlert/received_events","type":"User","site_admin":false},"created_at":"2016-02-22T12:50:00Z","updated_at":"2016-02-22T12:50:00Z","body":"I also have plan for this. Other tool that can do this is AutoMapper. It allows to pass run-time value to mapping.\r\n\r\nFor current version of Mapster, you might need to map manually after mapping.\r\n\r\n```\r\nvar dest = src.Adapt<DestClass>();\r\ndest.UserId = this.User.Identity.Name;\r\n```\r\n"}}