{"action":"created","issue":{"url":"https://api.github.com/repos/OData/WebApi/issues/139","labels_url":"https://api.github.com/repos/OData/WebApi/issues/139/labels{/name}","comments_url":"https://api.github.com/repos/OData/WebApi/issues/139/comments","events_url":"https://api.github.com/repos/OData/WebApi/issues/139/events","html_url":"https://github.com/OData/WebApi/issues/139","id":54014907,"number":139,"title":"OData: Enum keys not recognized by ODataConventionModelBuilder","user":{"login":"LianwMS","id":9375712,"avatar_url":"https://avatars.githubusercontent.com/u/9375712?v=3","gravatar_id":"","url":"https://api.github.com/users/LianwMS","html_url":"https://github.com/LianwMS","followers_url":"https://api.github.com/users/LianwMS/followers","following_url":"https://api.github.com/users/LianwMS/following{/other_user}","gists_url":"https://api.github.com/users/LianwMS/gists{/gist_id}","starred_url":"https://api.github.com/users/LianwMS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LianwMS/subscriptions","organizations_url":"https://api.github.com/users/LianwMS/orgs","repos_url":"https://api.github.com/users/LianwMS/repos","events_url":"https://api.github.com/users/LianwMS/events{/privacy}","received_events_url":"https://api.github.com/users/LianwMS/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"xuzhg","id":9426627,"avatar_url":"https://avatars.githubusercontent.com/u/9426627?v=3","gravatar_id":"","url":"https://api.github.com/users/xuzhg","html_url":"https://github.com/xuzhg","followers_url":"https://api.github.com/users/xuzhg/followers","following_url":"https://api.github.com/users/xuzhg/following{/other_user}","gists_url":"https://api.github.com/users/xuzhg/gists{/gist_id}","starred_url":"https://api.github.com/users/xuzhg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xuzhg/subscriptions","organizations_url":"https://api.github.com/users/xuzhg/orgs","repos_url":"https://api.github.com/users/xuzhg/repos","events_url":"https://api.github.com/users/xuzhg/events{/privacy}","received_events_url":"https://api.github.com/users/xuzhg/received_events","type":"User","site_admin":false},"milestone":null,"comments":3,"created_at":"2015-01-12T02:14:26Z","updated_at":"2015-01-12T02:14:34Z","closed_at":null,"body":"Given a class which contains properties:  \n\n    \n    \n            [Key,\n            Range(1, int.MaxValue)]\n            public int? Id { get; set; }\n    \n            /// <summary>\n            /// The type of client\n            /// </summary>\n            [Key]\n            public BusinessType ClientType { get; set; }\n\nWhere BusinessType is  \n\n    \n    \n        public enum BusinessType\n        {\n            Broker,\n            Agent\n        }\n\nWith configuration like:  \n\n    \n    \n                ODataConventionModelBuilder builder = new ODataConventionModelBuilder();\n                EntitySetConfiguration<Client> clients = builder.EntitySet<Client>(\"Clients\");           \n                var conventions = ODataRoutingConventions.CreateDefault();\n                conventions.Insert(0, new CompositeKeyRoutingConvention());\n                config.MapODataServiceRoute(\n                    routeName: \"odata\",\n                    routePrefix: \"odata\",\n                    model: builder.GetEdmModel(),\n                    pathHandler: new DefaultODataPathHandler(),\n                    routingConventions: conventions);\n\nThe generaeted $metadata does not include the enum type ClientType property  \n\n    \n    \n    <EntityType Name=\"Client\">\n    <Key>\n    <PropertyRef Name=\"Id\" />\n    </Key>\n\nWork Item Details\n--------------------\n**Original CodePlex Issue:**\t[Issue 2082](http://aspnetwebstack.codeplex.com/workitem/2082)\n**Status:**\tProposed\n**Reason Closed:**\tUnassigned\n**Assigned to:**\txuzhg\n**Reported on:**\tJul 29, 2014 at 11:27 PM\n**Reported by:**\trcollette\n**Updated on:**\tDec 3, 2014 at 4:02 PM\n**Updated by:**\ttroydalldorf\n"},"comment":{"url":"https://api.github.com/repos/OData/WebApi/issues/comments/69523789","html_url":"https://github.com/OData/WebApi/issues/139#issuecomment-69523789","issue_url":"https://api.github.com/repos/OData/WebApi/issues/139","id":69523789,"user":{"login":"LianwMS","id":9375712,"avatar_url":"https://avatars.githubusercontent.com/u/9375712?v=3","gravatar_id":"","url":"https://api.github.com/users/LianwMS","html_url":"https://github.com/LianwMS","followers_url":"https://api.github.com/users/LianwMS/followers","following_url":"https://api.github.com/users/LianwMS/following{/other_user}","gists_url":"https://api.github.com/users/LianwMS/gists{/gist_id}","starred_url":"https://api.github.com/users/LianwMS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LianwMS/subscriptions","organizations_url":"https://api.github.com/users/LianwMS/orgs","repos_url":"https://api.github.com/users/LianwMS/repos","events_url":"https://api.github.com/users/LianwMS/events{/privacy}","received_events_url":"https://api.github.com/users/LianwMS/received_events","type":"User","site_admin":false},"created_at":"2015-01-12T02:14:34Z","updated_at":"2015-01-12T02:14:34Z","body":"On *2014-08-05 03:37:13 UTC*, **rcollette** commented:\n\nI trace the issue down to System.Web.OData.Builder.EntityTypeConfiguration\n\r\nThe method: \n\r\npublic virtual EntityTypeConfiguration HasKey(PropertyInfo keyProperty)\n\r\nCreates only a PrimitivePropertyConfiguration and does not create a EnumPropertyConfiguration if the property being added as a Key is an enum.\n"}}