{"action":"created","issue":{"url":"https://api.github.com/repos/ServiceStack/Issues/issues/618","repository_url":"https://api.github.com/repos/ServiceStack/Issues","labels_url":"https://api.github.com/repos/ServiceStack/Issues/issues/618/labels{/name}","comments_url":"https://api.github.com/repos/ServiceStack/Issues/issues/618/comments","events_url":"https://api.github.com/repos/ServiceStack/Issues/issues/618/events","html_url":"https://github.com/ServiceStack/Issues/issues/618","id":332727048,"node_id":"MDU6SXNzdWUzMzI3MjcwNDg=","number":618,"title":"Bugfix Automatic Enum support with Npgsql 4.0 and newer","user":{"login":"jhf","id":18099,"node_id":"MDQ6VXNlcjE4MDk5","avatar_url":"https://avatars1.githubusercontent.com/u/18099?v=4","gravatar_id":"","url":"https://api.github.com/users/jhf","html_url":"https://github.com/jhf","followers_url":"https://api.github.com/users/jhf/followers","following_url":"https://api.github.com/users/jhf/following{/other_user}","gists_url":"https://api.github.com/users/jhf/gists{/gist_id}","starred_url":"https://api.github.com/users/jhf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jhf/subscriptions","organizations_url":"https://api.github.com/users/jhf/orgs","repos_url":"https://api.github.com/users/jhf/repos","events_url":"https://api.github.com/users/jhf/events{/privacy}","received_events_url":"https://api.github.com/users/jhf/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-06-15T10:39:52Z","updated_at":"2018-06-16T19:03:08Z","closed_at":"2018-06-16T19:03:08Z","author_association":"NONE","body":"We have tested running ServiceStack.OrmLite 5.1.0 with Npgsql 4.0.0 and then the automatic Enum support appears broken - failing with a `System.InvalidCastException` and the error message `Can't write CLR type NameOfEnum with handler type TextHandler`.\r\nThere are several breaking changes in Npgsql 4 [1] amongst them a change in how enums are handled, allowing both mapping from a C# enum to a Postgresql enum, and another way [2] of handling enums dynamically. While I would love to see a `PgEnum` attribute that supports this, I think it is critical to bugfix the automatic support of storing enum as a `varchar` `text`- hence this support issue.\r\n\r\nI'm assuming you'll reproduce this issue quickly by simply upgrading to Npgsql 4.0.0.\r\n\r\n[1] http://www.npgsql.org/doc/release-notes/4.0.html#breaking-changes-from-32\r\n[2] http://www.npgsql.org/doc/types/enums_and_composites.html\r\n "},"comment":{"url":"https://api.github.com/repos/ServiceStack/Issues/issues/comments/397832831","html_url":"https://github.com/ServiceStack/Issues/issues/618#issuecomment-397832831","issue_url":"https://api.github.com/repos/ServiceStack/Issues/issues/618","id":397832831,"node_id":"MDEyOklzc3VlQ29tbWVudDM5NzgzMjgzMQ==","user":{"login":"mythz","id":89361,"node_id":"MDQ6VXNlcjg5MzYx","avatar_url":"https://avatars1.githubusercontent.com/u/89361?v=4","gravatar_id":"","url":"https://api.github.com/users/mythz","html_url":"https://github.com/mythz","followers_url":"https://api.github.com/users/mythz/followers","following_url":"https://api.github.com/users/mythz/following{/other_user}","gists_url":"https://api.github.com/users/mythz/gists{/gist_id}","starred_url":"https://api.github.com/users/mythz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mythz/subscriptions","organizations_url":"https://api.github.com/users/mythz/orgs","repos_url":"https://api.github.com/users/mythz/repos","events_url":"https://api.github.com/users/mythz/events{/privacy}","received_events_url":"https://api.github.com/users/mythz/received_events","type":"User","site_admin":false},"created_at":"2018-06-16T19:03:08Z","updated_at":"2018-06-16T19:03:08Z","author_association":"MEMBER","body":"Npgsql v4 should now be supported from [this commit](https://github.com/ServiceStack/ServiceStack.OrmLite/commit/ded7d9bfe03ac502938fe2b97482b45fd4263b25). If you find any other issues please include a repro of the source code with the issue.\r\n\r\nThis change is available from v5.1.1 that's now [available on MyGet](http://docs.servicestack.net/myget).\r\n\r\n"}}
{"actor":{"display_login":"mythz"}}