Cannot connect to mysql from visual studio 2015 -
so have spent 2 days trying fix this. have succeeded in fixing on workplace pc , can't work on home pc. have read dozen articles , oracle forums articles , whatnot still not work.
i have 1.2.4 msql visual studio supposed release works on vs2015. have installed mysql connector 6.8.6 , have first tried add mysql project via nuget after not being able find 6.8.6 version (there 6.8.3 , 6.9.7 1 package , again else other...) have referenced c:\program files (x86)\mysql\mysql connector net 6.8.6\assemblies\v4.5 , have taken 4 files there , have copied them ove whole fkin computer. have pasted everywhere. vs2013 private assembly, packages folder not reference anyway , think vs2015 folder. have ran search mysql.data , have pasted these files in every folder came result. have rebuilt solution 100-200 times , have cried @ least 20 minutes.
what have new ado.net entity data model generated?
i keep getting stupid image , have absolutely no idea next. want code every time start doing keep wasting days on tools not working. have code in notepad sure it's fault isn't working?
this app.config file. not have else in project.
<?xml version="1.0" encoding="utf-8"?> <configuration> <configsections> <!-- more information on entity framework configuration, visit http://go.microsoft.com/fwlink/?linkid=237468 --> <section name="entityframework" type="system.data.entity.internal.configfile.entityframeworksection, entityframework, version=6.0.0.0, culture=neutral, publickeytoken=b77a5c561934e089" requirepermission="false" /> </configsections> <entityframework> <defaultconnectionfactory type="system.data.entity.infrastructure.localdbconnectionfactory, entityframework"> <parameters> <parameter value="v12.0" /> </parameters> </defaultconnectionfactory> <providers> <provider invariantname="system.data.sqlclient" type="system.data.entity.sqlserver.sqlproviderservices, entityframework.sqlserver" /> </providers> </entityframework> <system.data> <dbproviderfactories> <remove invariant="mysql.data.mysqlclient" /> <add name="mysql data provider" invariant="mysql.data.mysqlclient" description=".net framework data provider mysql" type="mysql.data.mysqlclient.mysqlclientfactory, mysql.data, version=6.8.6.0, culture=neutral, publickeytoken=c5687fc88969c44d" /> </dbproviderfactories> </system.data> <runtime> <assemblybinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentassembly> <assemblyidentity name="mysql.data" publickeytoken="c5687fc88969c44d" culture="neutral" /> <bindingredirect oldversion="0.0.0.0-6.8.6.0" newversion="6.8.6.0" /> </dependentassembly> </assemblybinding> </runtime> <connectionstrings> <add name="kplusconnectionstring" connectionstring="server=dito.ninja;user id=xxx;password=xxx;database=xxx" providername="mysql.data.mysqlclient" /> </connectionstrings> </configuration>
in order vs 2015 connect mysql need using later version of mysql libraries. while seems pretty simple answer, in honesty have run several problems along way. in mind going write out 1 process has consistently worked me far getting ef working mysql , vs2015. so, without further ado, here steps have been taking in order work.
1) make sure mysql connector installation updated
2) create web project
3) open nuget
4) install entity framework
5) search mysql
6) install mysql.data
7) install mysql.data.entity
8) install mysql.data.entities
9) install mysql.web
10) go references project , delete mysql.data.entity.ef6
11) check versions of mysql.data , mysql.web libraries. if under 6.9.6 delete them well
12) add new reference browsing install location mysql connector version of .net framework (mine c:\program files (x86)\mysql\connector.net 6.9\assemblies\v4.5) , grabbing mysql.data.entity.ef6.dll (my version 6.9.6, keep in mind when change web.config later)
13) if other libraries older versions, add references them browsing packages folder in solution , grabbing files respective folders. not have this.
14) web.config need edited. first step replace entity framework section code (change version number current version. please note found snippet on web couple weeks ago , not have original link. apologize original poster of information.)
<entityframework> <defaultconnectionfactory type="mysql.data.entity.mysqlconnectionfactory, mysql.data.entity.ef6" /> <providers> <provider invariantname="mysql.data.mysqlclient" type="mysql.data.mysqlclient.mysqlproviderservices, mysql.data.entity.ef6, version=6.9.6.0, culture=neutral, publickeytoken=c5687fc88969c44d" /> </providers> </entityframework>
15) make sure dbproviderfactories section matches
<dbproviderfactories> <remove invariant="mysql.data.mysqlclient" /> <add name="mysql data provider" invariant="mysql.data.mysqlclient" description=".net framework data provider mysql" type="mysql.data.mysqlclient.mysqlclientfactory, mysql.data, version=6.9.6.0, culture=neutral, publickeytoken=c5687fc88969c44d" /> </dbproviderfactories>
16) save , build
i not sure how many of these steps required after getting once had work done , didn’t have time narrow things down further. gets moving.
p.s. if after of go through wizard , disappears before shows tables in database create entities 1 of 3 problems have run along way. database server cannot contacted. user not have needed permissions on database. wrong version of mysql.data.entity.ef6 added reference or version number wrong in web.config. if grab file packages directory of solution run aborted-wizard-with-no-error-message problem. grabbing mysql install directory has worked fine me every time.
Comments
Post a Comment