{"action":"created","issue":{"url":"https://api.github.com/repos/dotnetcore/CAP/issues/84","repository_url":"https://api.github.com/repos/dotnetcore/CAP","labels_url":"https://api.github.com/repos/dotnetcore/CAP/issues/84/labels{/name}","comments_url":"https://api.github.com/repos/dotnetcore/CAP/issues/84/comments","events_url":"https://api.github.com/repos/dotnetcore/CAP/issues/84/events","html_url":"https://github.com/dotnetcore/CAP/issues/84","id":295063958,"number":84,"title":"Cannot configure the database table name prefix when using EntityFramework with MySql","user":{"login":"tirongaws","id":6996940,"avatar_url":"https://avatars3.githubusercontent.com/u/6996940?v=4","gravatar_id":"","url":"https://api.github.com/users/tirongaws","html_url":"https://github.com/tirongaws","followers_url":"https://api.github.com/users/tirongaws/followers","following_url":"https://api.github.com/users/tirongaws/following{/other_user}","gists_url":"https://api.github.com/users/tirongaws/gists{/gist_id}","starred_url":"https://api.github.com/users/tirongaws/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tirongaws/subscriptions","organizations_url":"https://api.github.com/users/tirongaws/orgs","repos_url":"https://api.github.com/users/tirongaws/repos","events_url":"https://api.github.com/users/tirongaws/events{/privacy}","received_events_url":"https://api.github.com/users/tirongaws/received_events","type":"User","site_admin":false},"labels":[{"id":500567621,"url":"https://api.github.com/repos/dotnetcore/CAP/labels/enhancement","name":"enhancement","color":"84b6eb","default":true},{"id":656029047,"url":"https://api.github.com/repos/dotnetcore/CAP/labels/fixed","name":"fixed","color":"0e8a16","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":7,"created_at":"2018-02-07T09:29:37Z","updated_at":"2018-02-08T08:09:55Z","closed_at":null,"author_association":"NONE","body":"我想要修改下Cap中表的前缀\r\n使用如下代码：\r\n```csharp\r\ncapOptions.UseMySql(mysqlOptions =>\r\n     {\r\n           mysqlOptions.ConnectionString = \"Server=192.168.69.177;Database=Dillon.Cap.Publisher;UserId=root;Password=Iubang001!;Allow User Variables=True\";\r\n           mysqlOptions.TableNamePrefix = \"my.cap\";\r\n     });\r\n```\r\n以上代码报错如下：\r\n>If you are using the EntityFramework, you need to configure the DbContextType first. otherwise you >need to use overloaded method with IDbConnection and IDbTransaction.  \r\n\r\n这个应该是因为 `MySqlOptions.DbContextType==null`\r\n\r\n但是`MySqlOptions.DbContextType` 作用域是 **internal**，没法直接赋值。 \r\n如果通过反射对`MySqlOptions.DbContextType` 就可以了\r\n```csharp\r\nvar dbContextType = typeof(EFOptions).GetProperty(\r\n       \"DbContextType\",\r\n       BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);\r\n       dbContextType.SetValue(mysqlOptions, typeof(AppDbContext));\r\n```\r\n用反射感觉不是很好，希望有更好的解决方案！"},"comment":{"url":"https://api.github.com/repos/dotnetcore/CAP/issues/comments/364033403","html_url":"https://github.com/dotnetcore/CAP/issues/84#issuecomment-364033403","issue_url":"https://api.github.com/repos/dotnetcore/CAP/issues/84","id":364033403,"user":{"login":"yuleyule66","id":8205994,"avatar_url":"https://avatars0.githubusercontent.com/u/8205994?v=4","gravatar_id":"","url":"https://api.github.com/users/yuleyule66","html_url":"https://github.com/yuleyule66","followers_url":"https://api.github.com/users/yuleyule66/followers","following_url":"https://api.github.com/users/yuleyule66/following{/other_user}","gists_url":"https://api.github.com/users/yuleyule66/gists{/gist_id}","starred_url":"https://api.github.com/users/yuleyule66/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yuleyule66/subscriptions","organizations_url":"https://api.github.com/users/yuleyule66/orgs","repos_url":"https://api.github.com/users/yuleyule66/repos","events_url":"https://api.github.com/users/yuleyule66/events{/privacy}","received_events_url":"https://api.github.com/users/yuleyule66/received_events","type":"User","site_admin":false},"created_at":"2018-02-08T08:09:55Z","updated_at":"2018-02-08T08:09:55Z","author_association":"OWNER","body":"@tirongaws 你好，我已经修复了这个问题"}}
{"actor":{"display_login":"yuleyule66"}}