{"action":"created","issue":{"url":"https://api.github.com/repos/AutoMapper/AutoMapper/issues/882","labels_url":"https://api.github.com/repos/AutoMapper/AutoMapper/issues/882/labels{/name}","comments_url":"https://api.github.com/repos/AutoMapper/AutoMapper/issues/882/comments","events_url":"https://api.github.com/repos/AutoMapper/AutoMapper/issues/882/events","html_url":"https://github.com/AutoMapper/AutoMapper/issues/882","id":105957315,"number":882,"title":"UseDataSource() with property-path expression leads to exception","user":{"login":"gentledepp","id":1175751,"avatar_url":"https://avatars.githubusercontent.com/u/1175751?v=3","gravatar_id":"","url":"https://api.github.com/users/gentledepp","html_url":"https://github.com/gentledepp","followers_url":"https://api.github.com/users/gentledepp/followers","following_url":"https://api.github.com/users/gentledepp/following{/other_user}","gists_url":"https://api.github.com/users/gentledepp/gists{/gist_id}","starred_url":"https://api.github.com/users/gentledepp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gentledepp/subscriptions","organizations_url":"https://api.github.com/users/gentledepp/orgs","repos_url":"https://api.github.com/users/gentledepp/repos","events_url":"https://api.github.com/users/gentledepp/events{/privacy}","received_events_url":"https://api.github.com/users/gentledepp/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/AutoMapper/AutoMapper/labels/Bug","name":"Bug","color":"e11d21"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/AutoMapper/AutoMapper/milestones/16","html_url":"https://github.com/AutoMapper/AutoMapper/milestones/4.2.0","labels_url":"https://api.github.com/repos/AutoMapper/AutoMapper/milestones/16/labels","id":1297835,"number":16,"title":"4.2.0","description":"","creator":{"login":"jbogard","id":104498,"avatar_url":"https://avatars.githubusercontent.com/u/104498?v=3","gravatar_id":"","url":"https://api.github.com/users/jbogard","html_url":"https://github.com/jbogard","followers_url":"https://api.github.com/users/jbogard/followers","following_url":"https://api.github.com/users/jbogard/following{/other_user}","gists_url":"https://api.github.com/users/jbogard/gists{/gist_id}","starred_url":"https://api.github.com/users/jbogard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jbogard/subscriptions","organizations_url":"https://api.github.com/users/jbogard/orgs","repos_url":"https://api.github.com/users/jbogard/repos","events_url":"https://api.github.com/users/jbogard/events{/privacy}","received_events_url":"https://api.github.com/users/jbogard/received_events","type":"User","site_admin":false},"open_issues":22,"closed_issues":4,"state":"open","created_at":"2015-09-09T14:46:10Z","updated_at":"2015-11-27T00:00:12Z","due_on":"2016-01-19T06:00:00Z","closed_at":null},"comments":17,"created_at":"2015-09-11T07:19:22Z","updated_at":"2015-12-02T15:39:52Z","closed_at":null,"body":"given the following DTO hierarchy\r\n\r\n<pre>\r\nprivate class Master\r\n        {\r\n            public Master()\r\n            {\r\n                Details = new HashSet();\r\n            }\r\n            public Guid Id { get; set; }\r\n            public string Name { get; set; }\r\n            public ICollection Details { get; set; }\r\n        }\r\n\r\n        private class Detail\r\n        {\r\n            public Guid Id { get; set; }\r\n            public string Name { get; set; }\r\n            public Master Master { get; set; }\r\n        }\r\n</pre>\r\nthe following expression fails to be mapped\r\n<pre>\r\nvar detailDtoQuery = detailQuery.UseAsDataSource()\r\n                .OnError(ex => exceptions.Add(ex))\r\n                .For()\r\n                .Where(d => d.Master.Name == \"Harry Marry\");\r\n</pre>\r\n\r\nTo fix it, you just need to rename one of the \"Name\" properties. Problem is that the outer Expression (of type DetailDto) is used to retrieve the property \"Name\" and thus the MethodInfo points to the wrong class (DetailDto)."},"comment":{"url":"https://api.github.com/repos/AutoMapper/AutoMapper/issues/comments/161337434","html_url":"https://github.com/AutoMapper/AutoMapper/issues/882#issuecomment-161337434","issue_url":"https://api.github.com/repos/AutoMapper/AutoMapper/issues/882","id":161337434,"user":{"login":"TylerCarlson1","id":6801536,"avatar_url":"https://avatars.githubusercontent.com/u/6801536?v=3","gravatar_id":"","url":"https://api.github.com/users/TylerCarlson1","html_url":"https://github.com/TylerCarlson1","followers_url":"https://api.github.com/users/TylerCarlson1/followers","following_url":"https://api.github.com/users/TylerCarlson1/following{/other_user}","gists_url":"https://api.github.com/users/TylerCarlson1/gists{/gist_id}","starred_url":"https://api.github.com/users/TylerCarlson1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TylerCarlson1/subscriptions","organizations_url":"https://api.github.com/users/TylerCarlson1/orgs","repos_url":"https://api.github.com/users/TylerCarlson1/repos","events_url":"https://api.github.com/users/TylerCarlson1/events{/privacy}","received_events_url":"https://api.github.com/users/TylerCarlson1/received_events","type":"User","site_admin":false},"created_at":"2015-12-02T15:39:51Z","updated_at":"2015-12-02T15:39:51Z","body":"Yes You are right. UseAsDataSource does not have parameterization right now\n\nSent from my iPhone\n\nOn Dec 2, 2015, at 9:08 AM, gentledepp <notifications@github.com<mailto:notifications@github.com>> wrote:\n\n\nJust one question out of context (sry) - but ProjectTo allows parameterization:\nhttps://github.com/AutoMapper/AutoMapper/wiki/Queryable-Extensions\nso I can write stuff like\n\ndbContext.Courses.ProjectTo(new { currentUserName = Request.User.Name });\n\nI need the same functionality in \"UseAsDataSource()\" but it seems to me it is not implemented yet.\nAm I right? In that case I'll probably try to add this functionality along with explicit expansion this weekend. (with UTs of course)\n\n-\nReply to this email directly or view it on GitHub<https://github.com/AutoMapper/AutoMapper/issues/882#issuecomment-161326651>.\n"}}