{"action":"created","comment":{"url":"https://api.github.com/repos/ParticularLabs/NServiceBus.FileBasedRouting/pulls/comments/90253659","pull_request_review_id":10774980,"id":90253659,"diff_hunk":"@@ -2,42 +2,83 @@\n using System.Collections.Generic;\n using System.IO;\n using System.Linq;\n+using System.Reflection;\n+using System.Xml;\n using System.Xml.Linq;\n+using System.Xml.Schema;\n \n namespace NServiceBus.FileBasedRouting\n {\n-    class XmlRoutingFile\n+    public class XmlRoutingFile\n     {\n-        private readonly string filePath;\n-\n-        public XmlRoutingFile(string filePath)\n+        public XmlRoutingFile(Func<Stream> streamAccessor)\n         {\n-            this.filePath = filePath;\n+            this.streamAccessor = streamAccessor;\n+\n+            using (var stream = GetType().Assembly.GetManifestResourceStream(\"NServiceBus.FileBasedRouting.routing.xsd\"))\n+            using (var xmlReader = XmlReader.Create(stream))\n+            {\n+                schema = new XmlSchemaSet();\n+                schema.Add(\"\", xmlReader);\n+            }\n         }\n \n         public IEnumerable<EndpointRoutingConfiguration> Read()\n         {\n-            using (var fileStream = File.OpenRead(filePath))\n+            using (var stream = streamAccessor())\n             {\n-                var document = XDocument.Load(fileStream);\n+                var document = XDocument.Load(stream);\n+                document.Validate(schema, null, true);\n+\n                 var endpointElements = document.Root.Descendants(\"endpoint\");\n \n                 var configs = new List<EndpointRoutingConfiguration>();\n                 foreach (var endpointElement in endpointElements)\n                 {\n-                    var config = new EndpointRoutingConfiguration();\n-                    config.LogicalEndpointName = endpointElement.Attribute(\"name\").Value;\n+                    var config = new EndpointRoutingConfiguration\n+                    {\n+                        LogicalEndpointName = endpointElement.Attribute(\"name\").Value\n+                    };\n \n-                    config.Commands = endpointElement.Element(\"handles\")\n-                        ?.Elements(\"command\")\n-                        .Select(e => Type.GetType(e.Attribute(\"type\").Value, true))\n-                        .ToArray() ?? new Type[0];\n+                    var handles = endpointElement.Element(\"handles\");\n \n+                    var separatelyConfiguredCommands = handles\n+                                             ?.Elements(\"command\")\n+                                             .Select(e => SelectCommand(e.Attribute(\"type\").Value))\n+                                             .ToArray() ?? Type.EmptyTypes;\n+\n+                    var filteredCommands = handles?.Elements(\"commands\").SelectMany(SelectCommands) ?? Type.EmptyTypes;\n+\n+                    config.Commands = separatelyConfiguredCommands.Concat(filteredCommands).Distinct().ToArray();","path":"NServiceBus.FileBasedRouting/XmlRoutingFile.cs","position":64,"original_position":64,"commit_id":"e73cc8b5e915e5a1baf028d102c0258299d0718f","original_commit_id":"e73cc8b5e915e5a1baf028d102c0258299d0718f","user":{"login":"Scooletz","id":519707,"avatar_url":"https://avatars.githubusercontent.com/u/519707?v=3","gravatar_id":"","url":"https://api.github.com/users/Scooletz","html_url":"https://github.com/Scooletz","followers_url":"https://api.github.com/users/Scooletz/followers","following_url":"https://api.github.com/users/Scooletz/following{/other_user}","gists_url":"https://api.github.com/users/Scooletz/gists{/gist_id}","starred_url":"https://api.github.com/users/Scooletz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Scooletz/subscriptions","organizations_url":"https://api.github.com/users/Scooletz/orgs","repos_url":"https://api.github.com/users/Scooletz/repos","events_url":"https://api.github.com/users/Scooletz/events{/privacy}","received_events_url":"https://api.github.com/users/Scooletz/received_events","type":"User","site_admin":false},"body":"Strange, my coverage was 100% ;-) Sure. Will add.","created_at":"2016-11-30T15:22:39Z","updated_at":"2016-11-30T15:22:39Z","html_url":"https://github.com/ParticularLabs/NServiceBus.FileBasedRouting/pull/5#discussion_r90253659","pull_request_url":"https://api.github.com/repos/ParticularLabs/NServiceBus.FileBasedRouting/pulls/5","_links":{"self":{"href":"https://api.github.com/repos/ParticularLabs/NServiceBus.FileBasedRouting/pulls/comments/90253659"},"html":{"href":"https://github.com/ParticularLabs/NServiceBus.FileBasedRouting/pull/5#discussion_r90253659"},"pull_request":{"href":"https://api.github.com/repos/ParticularLabs/NServiceBus.FileBasedRouting/pulls/5"}}},"pull_request":{"url":"https://api.github.com/repos/ParticularLabs/NServiceBus.FileBasedRouting/pulls/5","id":95501639,"html_url":"https://github.com/ParticularLabs/NServiceBus.FileBasedRouting/pull/5","diff_url":"https://github.com/ParticularLabs/NServiceBus.FileBasedRouting/pull/5.diff","patch_url":"https://github.com/ParticularLabs/NServiceBus.FileBasedRouting/pull/5.patch","issue_url":"https://api.github.com/repos/ParticularLabs/NServiceBus.FileBasedRouting/issues/5","number":5,"state":"open","locked":false,"title":"Xsd based file mapping","user":{"login":"Scooletz","id":519707,"avatar_url":"https://avatars.githubusercontent.com/u/519707?v=3","gravatar_id":"","url":"https://api.github.com/users/Scooletz","html_url":"https://github.com/Scooletz","followers_url":"https://api.github.com/users/Scooletz/followers","following_url":"https://api.github.com/users/Scooletz/following{/other_user}","gists_url":"https://api.github.com/users/Scooletz/gists{/gist_id}","starred_url":"https://api.github.com/users/Scooletz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Scooletz/subscriptions","organizations_url":"https://api.github.com/users/Scooletz/orgs","repos_url":"https://api.github.com/users/Scooletz/repos","events_url":"https://api.github.com/users/Scooletz/events{/privacy}","received_events_url":"https://api.github.com/users/Scooletz/received_events","type":"User","site_admin":false},"body":"After going through the xsd based class generation attempts (serializers assembly etx) I fell back to the initial idea of `InstanceMapping` from the core.","created_at":"2016-11-28T13:49:43Z","updated_at":"2016-11-30T15:22:39Z","closed_at":null,"merged_at":null,"merge_commit_sha":"074f206e7639c2c01905ff4d5f66f7d769580f6d","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/ParticularLabs/NServiceBus.FileBasedRouting/pulls/5/commits","review_comments_url":"https://api.github.com/repos/ParticularLabs/NServiceBus.FileBasedRouting/pulls/5/comments","review_comment_url":"https://api.github.com/repos/ParticularLabs/NServiceBus.FileBasedRouting/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ParticularLabs/NServiceBus.FileBasedRouting/issues/5/comments","statuses_url":"https://api.github.com/repos/ParticularLabs/NServiceBus.FileBasedRouting/statuses/e73cc8b5e915e5a1baf028d102c0258299d0718f","head":{"label":"ParticularLabs:xsd-based-file-mapping","ref":"xsd-based-file-mapping","sha":"e73cc8b5e915e5a1baf028d102c0258299d0718f","user":{"login":"ParticularLabs","id":9639057,"avatar_url":"https://avatars.githubusercontent.com/u/9639057?v=3","gravatar_id":"","url":"https://api.github.com/users/ParticularLabs","html_url":"https://github.com/ParticularLabs","followers_url":"https://api.github.com/users/ParticularLabs/followers","following_url":"https://api.github.com/users/ParticularLabs/following{/other_user}","gists_url":"https://api.github.com/users/ParticularLabs/gists{/gist_id}","starred_url":"https://api.github.com/users/ParticularLabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ParticularLabs/subscriptions","organizations_url":"https://api.github.com/users/ParticularLabs/orgs","repos_url":"https://api.github.com/users/ParticularLabs/repos","events_url":"https://api.github.com/users/ParticularLabs/events{/privacy}","received_events_url":"https://api.github.com/users/ParticularLabs/received_events","type":"Organization","site_admin":false},"repo":{"id":73902556,"name":"NServiceBus.FileBasedRouting","full_name":"ParticularLabs/NServiceBus.FileBasedRouting","owner":{"login":"ParticularLabs","id":9639057,"avatar_url":"https://avatars.githubusercontent.com/u/9639057?v=3","gravatar_id":"","url":"https://api.github.com/users/ParticularLabs","html_url":"https://github.com/ParticularLabs","followers_url":"https://api.github.com/users/ParticularLabs/followers","following_url":"https://api.github.com/users/ParticularLabs/following{/other_user}","gists_url":"https://api.github.com/users/ParticularLabs/gists{/gist_id}","starred_url":"https://api.github.com/users/ParticularLabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ParticularLabs/subscriptions","organizations_url":"https://api.github.com/users/ParticularLabs/orgs","repos_url":"https://api.github.com/users/ParticularLabs/repos","events_url":"https://api.github.com/users/ParticularLabs/events{/privacy}","received_events_url":"https://api.github.com/users/ParticularLabs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ParticularLabs/NServiceBus.FileBasedRouting","description":null,"fork":false,"url":"https://api.github.com/repos/ParticularLabs/NServiceBus.FileBasedRouting","forks_url":"https://api.github.com/repos/ParticularLabs/NServiceBus.FileBasedRouting/forks","keys_url":"https://api.github.com/repos/ParticularLabs/NServiceBus.FileBasedRouting/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ParticularLabs/NServiceBus.FileBasedRouting/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ParticularLabs/NServiceBus.FileBasedRouting/teams","hooks_url":"https://api.github.com/repos/ParticularLabs/NServiceBus.FileBasedRouting/hooks","issue_events_url":"https://api.github.com/repos/ParticularLabs/NServiceBus.FileBasedRouting/issues/events{/number}","events_url":"https://api.github.com/repos/ParticularLabs/NServiceBus.FileBasedRouting/events","assignees_url":"https://api.github.com/repos/ParticularLabs/NServiceBus.FileBasedRouting/assignees{/user}","branches_url":"https://api.github.com/repos/ParticularLabs/NServiceBus.FileBasedRouting/branches{/branch}","tags_url":"https://api.github.com/repos/ParticularLabs/NServiceBus.FileBasedRouting/tags","blobs_url":"https://api.github.com/repos/ParticularLabs/NServiceBus.FileBasedRouting/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ParticularLabs/NServiceBus.FileBasedRouting/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ParticularLabs/NServiceBus.FileBasedRouting/git/refs{/sha}","trees_url":"https://api.github.com/repos/ParticularLabs/NServiceBus.FileBasedRouting/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ParticularLabs/NServiceBus.FileBasedRouting/statuses/{sha}","languages_url":"https://api.github.com/repos/ParticularLabs/NServiceBus.FileBasedRouting/languages","stargazers_url":"https://api.github.com/repos/ParticularLabs/NServiceBus.FileBasedRouting/stargazers","contributors_url":"https://api.github.com/repos/ParticularLabs/NServiceBus.FileBasedRouting/contributors","subscribers_url":"https://api.github.com/repos/ParticularLabs/NServiceBus.FileBasedRouting/subscribers","subscription_url":"https://api.github.com/repos/ParticularLabs/NServiceBus.FileBasedRouting/subscription","commits_url":"https://api.github.com/repos/ParticularLabs/NServiceBus.FileBasedRouting/commits{/sha}","git_commits_url":"https://api.github.com/repos/ParticularLabs/NServiceBus.FileBasedRouting/git/commits{/sha}","comments_url":"https://api.github.com/repos/ParticularLabs/NServiceBus.FileBasedRouting/comments{/number}","issue_comment_url":"https://api.github.com/repos/ParticularLabs/NServiceBus.FileBasedRouting/issues/comments{/number}","contents_url":"https://api.github.com/repos/ParticularLabs/NServiceBus.FileBasedRouting/contents/{+path}","compare_url":"https://api.github.com/repos/ParticularLabs/NServiceBus.FileBasedRouting/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ParticularLabs/NServiceBus.FileBasedRouting/merges","archive_url":"https://api.github.com/repos/ParticularLabs/NServiceBus.FileBasedRouting/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ParticularLabs/NServiceBus.FileBasedRouting/downloads","issues_url":"https://api.github.com/repos/ParticularLabs/NServiceBus.FileBasedRouting/issues{/number}","pulls_url":"https://api.github.com/repos/ParticularLabs/NServiceBus.FileBasedRouting/pulls{/number}","milestones_url":"https://api.github.com/repos/ParticularLabs/NServiceBus.FileBasedRouting/milestones{/number}","notifications_url":"https://api.github.com/repos/ParticularLabs/NServiceBus.FileBasedRouting/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ParticularLabs/NServiceBus.FileBasedRouting/labels{/name}","releases_url":"https://api.github.com/repos/ParticularLabs/NServiceBus.FileBasedRouting/releases{/id}","deployments_url":"https://api.github.com/repos/ParticularLabs/NServiceBus.FileBasedRouting/deployments","created_at":"2016-11-16T09:05:39Z","updated_at":"2016-11-16T10:38:32Z","pushed_at":"2016-11-30T13:25:16Z","git_url":"git://github.com/ParticularLabs/NServiceBus.FileBasedRouting.git","ssh_url":"git@github.com:ParticularLabs/NServiceBus.FileBasedRouting.git","clone_url":"https://github.com/ParticularLabs/NServiceBus.FileBasedRouting.git","svn_url":"https://github.com/ParticularLabs/NServiceBus.FileBasedRouting","homepage":null,"size":27,"stargazers_count":0,"watchers_count":0,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":6,"forks":0,"open_issues":6,"watchers":0,"default_branch":"master"}},"base":{"label":"ParticularLabs:master","ref":"master","sha":"73fb6198856b9ac3f24f5914b26d5e27fbb52cca","user":{"login":"ParticularLabs","id":9639057,"avatar_url":"https://avatars.githubusercontent.com/u/9639057?v=3","gravatar_id":"","url":"https://api.github.com/users/ParticularLabs","html_url":"https://github.com/ParticularLabs","followers_url":"https://api.github.com/users/ParticularLabs/followers","following_url":"https://api.github.com/users/ParticularLabs/following{/other_user}","gists_url":"https://api.github.com/users/ParticularLabs/gists{/gist_id}","starred_url":"https://api.github.com/users/ParticularLabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ParticularLabs/subscriptions","organizations_url":"https://api.github.com/users/ParticularLabs/orgs","repos_url":"https://api.github.com/users/ParticularLabs/repos","events_url":"https://api.github.com/users/ParticularLabs/events{/privacy}","received_events_url":"https://api.github.com/users/ParticularLabs/received_events","type":"Organization","site_admin":false},"repo":{"id":73902556,"name":"NServiceBus.FileBasedRouting","full_name":"ParticularLabs/NServiceBus.FileBasedRouting","owner":{"login":"ParticularLabs","id":9639057,"avatar_url":"https://avatars.githubusercontent.com/u/9639057?v=3","gravatar_id":"","url":"https://api.github.com/users/ParticularLabs","html_url":"https://github.com/ParticularLabs","followers_url":"https://api.github.com/users/ParticularLabs/followers","following_url":"https://api.github.com/users/ParticularLabs/following{/other_user}","gists_url":"https://api.github.com/users/ParticularLabs/gists{/gist_id}","starred_url":"https://api.github.com/users/ParticularLabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ParticularLabs/subscriptions","organizations_url":"https://api.github.com/users/ParticularLabs/orgs","repos_url":"https://api.github.com/users/ParticularLabs/repos","events_url":"https://api.github.com/users/ParticularLabs/events{/privacy}","received_events_url":"https://api.github.com/users/ParticularLabs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ParticularLabs/NServiceBus.FileBasedRouting","description":null,"fork":false,"url":"https://api.github.com/repos/ParticularLabs/NServiceBus.FileBasedRouting","forks_url":"https://api.github.com/repos/ParticularLabs/NServiceBus.FileBasedRouting/forks","keys_url":"https://api.github.com/repos/ParticularLabs/NServiceBus.FileBasedRouting/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ParticularLabs/NServiceBus.FileBasedRouting/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ParticularLabs/NServiceBus.FileBasedRouting/teams","hooks_url":"https://api.github.com/repos/ParticularLabs/NServiceBus.FileBasedRouting/hooks","issue_events_url":"https://api.github.com/repos/ParticularLabs/NServiceBus.FileBasedRouting/issues/events{/number}","events_url":"https://api.github.com/repos/ParticularLabs/NServiceBus.FileBasedRouting/events","assignees_url":"https://api.github.com/repos/ParticularLabs/NServiceBus.FileBasedRouting/assignees{/user}","branches_url":"https://api.github.com/repos/ParticularLabs/NServiceBus.FileBasedRouting/branches{/branch}","tags_url":"https://api.github.com/repos/ParticularLabs/NServiceBus.FileBasedRouting/tags","blobs_url":"https://api.github.com/repos/ParticularLabs/NServiceBus.FileBasedRouting/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ParticularLabs/NServiceBus.FileBasedRouting/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ParticularLabs/NServiceBus.FileBasedRouting/git/refs{/sha}","trees_url":"https://api.github.com/repos/ParticularLabs/NServiceBus.FileBasedRouting/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ParticularLabs/NServiceBus.FileBasedRouting/statuses/{sha}","languages_url":"https://api.github.com/repos/ParticularLabs/NServiceBus.FileBasedRouting/languages","stargazers_url":"https://api.github.com/repos/ParticularLabs/NServiceBus.FileBasedRouting/stargazers","contributors_url":"https://api.github.com/repos/ParticularLabs/NServiceBus.FileBasedRouting/contributors","subscribers_url":"https://api.github.com/repos/ParticularLabs/NServiceBus.FileBasedRouting/subscribers","subscription_url":"https://api.github.com/repos/ParticularLabs/NServiceBus.FileBasedRouting/subscription","commits_url":"https://api.github.com/repos/ParticularLabs/NServiceBus.FileBasedRouting/commits{/sha}","git_commits_url":"https://api.github.com/repos/ParticularLabs/NServiceBus.FileBasedRouting/git/commits{/sha}","comments_url":"https://api.github.com/repos/ParticularLabs/NServiceBus.FileBasedRouting/comments{/number}","issue_comment_url":"https://api.github.com/repos/ParticularLabs/NServiceBus.FileBasedRouting/issues/comments{/number}","contents_url":"https://api.github.com/repos/ParticularLabs/NServiceBus.FileBasedRouting/contents/{+path}","compare_url":"https://api.github.com/repos/ParticularLabs/NServiceBus.FileBasedRouting/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ParticularLabs/NServiceBus.FileBasedRouting/merges","archive_url":"https://api.github.com/repos/ParticularLabs/NServiceBus.FileBasedRouting/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ParticularLabs/NServiceBus.FileBasedRouting/downloads","issues_url":"https://api.github.com/repos/ParticularLabs/NServiceBus.FileBasedRouting/issues{/number}","pulls_url":"https://api.github.com/repos/ParticularLabs/NServiceBus.FileBasedRouting/pulls{/number}","milestones_url":"https://api.github.com/repos/ParticularLabs/NServiceBus.FileBasedRouting/milestones{/number}","notifications_url":"https://api.github.com/repos/ParticularLabs/NServiceBus.FileBasedRouting/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ParticularLabs/NServiceBus.FileBasedRouting/labels{/name}","releases_url":"https://api.github.com/repos/ParticularLabs/NServiceBus.FileBasedRouting/releases{/id}","deployments_url":"https://api.github.com/repos/ParticularLabs/NServiceBus.FileBasedRouting/deployments","created_at":"2016-11-16T09:05:39Z","updated_at":"2016-11-16T10:38:32Z","pushed_at":"2016-11-30T13:25:16Z","git_url":"git://github.com/ParticularLabs/NServiceBus.FileBasedRouting.git","ssh_url":"git@github.com:ParticularLabs/NServiceBus.FileBasedRouting.git","clone_url":"https://github.com/ParticularLabs/NServiceBus.FileBasedRouting.git","svn_url":"https://github.com/ParticularLabs/NServiceBus.FileBasedRouting","homepage":null,"size":27,"stargazers_count":0,"watchers_count":0,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":6,"forks":0,"open_issues":6,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ParticularLabs/NServiceBus.FileBasedRouting/pulls/5"},"html":{"href":"https://github.com/ParticularLabs/NServiceBus.FileBasedRouting/pull/5"},"issue":{"href":"https://api.github.com/repos/ParticularLabs/NServiceBus.FileBasedRouting/issues/5"},"comments":{"href":"https://api.github.com/repos/ParticularLabs/NServiceBus.FileBasedRouting/issues/5/comments"},"review_comments":{"href":"https://api.github.com/repos/ParticularLabs/NServiceBus.FileBasedRouting/pulls/5/comments"},"review_comment":{"href":"https://api.github.com/repos/ParticularLabs/NServiceBus.FileBasedRouting/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ParticularLabs/NServiceBus.FileBasedRouting/pulls/5/commits"},"statuses":{"href":"https://api.github.com/repos/ParticularLabs/NServiceBus.FileBasedRouting/statuses/e73cc8b5e915e5a1baf028d102c0258299d0718f"}}}}
{"actor":{"display_login":"Scooletz"}}