2019年4月20日 星期六

取得 Entity Framework 存取 DB 時的實際 SQL Script

https://blog.yowko.com/entityframework-log-sql/

LocalDbConnectionFactory和SqlconnectionFactory


System.Data.Entity.Infrastructure Namespace
https://docs.microsoft.com/en-us/dotnet/api/system.data.entity.infrastructure?view=entity-framework-6.2.0


SqlConnectionFactory Class
https://docs.microsoft.com/en-us/dotnet/api/system.data.entity.infrastructure.sqlconnectionfactory?view=entity-framework-6.2.0
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlconnectionFactory, EntityFramework">


LocalDbConnectionFactory Class
https://docs.microsoft.com/en-us/dotnet/api/system.data.entity.infrastructure.localdbconnectionfactory?view=entity-framework-6.2.0
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">


[ASP.NET MVC] DB Connection 從LocalDb Connection變更為 SQL Server Connection
https://jeterh.blogspot.com/2015/08/aspnet-mvc-db-connection-localdb.html


ORACLE資料庫
<entityFramework>
  <defaultConnectionFactory type="Oracle.ManagedDataAccess.EntityFramework.OracleConnectionFactory, Oracle.ManagedDataAccess.EntityFramework, Version=6.121.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342" />
  <providers>


MYSQL資料庫
https://dev.mysql.com/doc/connector-net/en/connector-net-entityframework60.html
<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>


DB2資料庫
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
<providers>
<provider invariantName="IBM.Data.DB2" type="IBM.Data.DB2.EntityFramework.DB2ProviderServices, IBM.Data.DB2.EntityFramework, Version=10.5.5.6, Culture=neutral, PublicKeyToken=7c307b91aa13d208" />
</providers>
</entityFramework>