{"action":"created","issue":{"url":"https://api.github.com/repos/StackExchange/dapper-dot-net/issues/447","repository_url":"https://api.github.com/repos/StackExchange/dapper-dot-net","labels_url":"https://api.github.com/repos/StackExchange/dapper-dot-net/issues/447/labels{/name}","comments_url":"https://api.github.com/repos/StackExchange/dapper-dot-net/issues/447/comments","events_url":"https://api.github.com/repos/StackExchange/dapper-dot-net/issues/447/events","html_url":"https://github.com/StackExchange/dapper-dot-net/issues/447","id":130362536,"number":447,"title":"Invalid cast from 'System.String' to 'System.Guid'","user":{"login":"dumbledad","id":110564,"avatar_url":"https://avatars.githubusercontent.com/u/110564?v=3","gravatar_id":"","url":"https://api.github.com/users/dumbledad","html_url":"https://github.com/dumbledad","followers_url":"https://api.github.com/users/dumbledad/followers","following_url":"https://api.github.com/users/dumbledad/following{/other_user}","gists_url":"https://api.github.com/users/dumbledad/gists{/gist_id}","starred_url":"https://api.github.com/users/dumbledad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dumbledad/subscriptions","organizations_url":"https://api.github.com/users/dumbledad/orgs","repos_url":"https://api.github.com/users/dumbledad/repos","events_url":"https://api.github.com/users/dumbledad/events{/privacy}","received_events_url":"https://api.github.com/users/dumbledad/received_events","type":"User","site_admin":false},"labels":[{"id":271101142,"url":"https://api.github.com/repos/StackExchange/dapper-dot-net/labels/enhancement","name":"enhancement","color":"207de5","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":12,"created_at":"2016-02-01T13:29:12Z","updated_at":"2016-11-08T22:07:47Z","closed_at":null,"body":"My Id is defined in tSQL as\n\n```\nid NVARCHAR (128) DEFAULT (NEWID()) NOT NULL\n```\n\nand in C# as \n\n```\npublic Guid Id { get; set; }\n```\n\nDapper generates an error `Invalid cast from 'System.String' to 'System.Guid'`. One solution (from [here](http://stackoverflow.com/a/31607532/575530)) is to add a private IdString thus\n\n```\nprivate string IdString { get; set; }\npublic Guid Id\n{\n    get\n    {\n        return new Guid(IdString);\n    }\n    set\n    {\n        IdString = value.ToString();\n    }\n}\n```\n\nand changing the tSQL from `id` to `Id AS IdString`.\n\nIt's a bit painful not to be able to use `SELECT *` because of that alias.\n\nUsing `Guid` as an id column seems common practice.\n\nShould there not be a built in mechanism for casting between Guids and strings?\n"},"comment":{"url":"https://api.github.com/repos/StackExchange/dapper-dot-net/issues/comments/259274844","html_url":"https://github.com/StackExchange/dapper-dot-net/issues/447#issuecomment-259274844","issue_url":"https://api.github.com/repos/StackExchange/dapper-dot-net/issues/447","id":259274844,"user":{"login":"mtrtm","id":8888546,"avatar_url":"https://avatars.githubusercontent.com/u/8888546?v=3","gravatar_id":"","url":"https://api.github.com/users/mtrtm","html_url":"https://github.com/mtrtm","followers_url":"https://api.github.com/users/mtrtm/followers","following_url":"https://api.github.com/users/mtrtm/following{/other_user}","gists_url":"https://api.github.com/users/mtrtm/gists{/gist_id}","starred_url":"https://api.github.com/users/mtrtm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mtrtm/subscriptions","organizations_url":"https://api.github.com/users/mtrtm/orgs","repos_url":"https://api.github.com/users/mtrtm/repos","events_url":"https://api.github.com/users/mtrtm/events{/privacy}","received_events_url":"https://api.github.com/users/mtrtm/received_events","type":"User","site_admin":false},"created_at":"2016-11-08T22:07:47Z","updated_at":"2016-11-08T22:07:47Z","body":"Does the beta only support char(32) in MySQL to .net Guid, or does it also support binary(16) to Guid? "}}
{"actor":{"display_login":"mtrtm"}}