c# - Setup Entity Framework 6 with Mysql - Code first -


i trying setup existing project use entity framework. have never used before , want learn on personal project.

i have solution many projects, related. login wanna querys. model model is. main program starts.

i have installed entityframework onto mysolution.model.

this app.config model:

<connectionstrings>     <add name="aldatabasecontext" providername="mysql.data.mysqlclient"         connectionstring="server=localhost;port=3306;database=aldatabase;uid=root;password=root"/> </connectionstrings> <entityframework>     <defaultconnectionfactory type="system.data.entity.infrastructure.sqlconnectionfactory, entityframework"/> <providers>     <provider invariantname="mysql.data.mysqlclient"       type="mysql.data.mysqlclient.mysqlproviderservices, mysql.data.entity.ef6"/>      <provider invariantname="system.data.sqlclient"       type="system.data.entity.sqlserver.sqlproviderservices, entityframework.sqlserver"/> </providers> </entityframework> 

my context simple

public class aldatabasecontext : dbcontext {     public virtual dbset<user> users { get; set; } } 

but when call context login exception:

additional information: no entity framework provider found ado.net provider invariant name 'system.data.sqlclient'. make sure provider registered in 'entityframework' section of application config file.

what missing?

ok, managed working (but don't solution).

i have added app.config of main (the entry point of solution):

<connectionstrings> <add name="aldatabasecontext" providername="mysql.data.mysqlclient" connectionstring="server=localhost;port=3306;database=aldatabase;uid=root;password=root" /> </connectionstrings>    <entityframework> <defaultconnectionfactory type="system.data.entity.infrastructure.sqlconnectionfactory, entityframework" /> <providers>   <provider invariantname="system.data.sqlclient" type="system.data.entity.sqlserver.sqlproviderservices, entityframework.sqlserver" />   <provider invariantname="mysql.data.mysqlclient" type="mysql.data.mysqlclient.mysqlproviderservices, mysql.data.entity.ef6, version=6.9.9.0, culture=neutral, publickeytoken=c5687fc88969c44d"></provider> </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.9.9.0, culture=neutral, publickeytoken=c5687fc88969c44d" /> </dbproviderfactories> 

and referenced dlls of model (entity framework related dll , mysql dlls) @ login , main projects.


Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -