Skip to content
Simon Hughes edited this page May 24, 2023 · 6 revisions

machine.config

In both

  • c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\machine.config
  • c:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\machine.config

search for <system.data>, (approximately line 168). I have the following <system.data> XML where you will see an entry for SQLite Data Provider has been added:

<system.data>
    <DbProviderFactories>
      <add name="Microsoft SQL Server Compact Data Provider 4.0" invariant="System.Data.SqlServerCe.4.0" description=".NET Framework Data Provider for Microsoft SQL Server Compact" type="System.Data.SqlServerCe.SqlCeProviderFactory, System.Data.SqlServerCe, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91"/>
      <add name="Npgsql Data Provider" invariant="Npgsql" description=".NET Data Provider for PostgreSQL" type="Npgsql.NpgsqlFactory, Npgsql, Version=4.1.8.0, Culture=neutral, PublicKeyToken=5D8B90D52F46FDA7"/>
      <add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=8.0.29.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"/>
      <add name="ODP.NET, Managed Driver" invariant="Oracle.ManagedDataAccess.Client" description="Oracle Data Provider for .NET, Managed Driver" type="Oracle.ManagedDataAccess.Client.OracleClientFactory, Oracle.ManagedDataAccess, Version=4.122.19.1, Culture=neutral, PublicKeyToken=89b483f429c47342"/>
      <add name="SQLite Data Provider" invariant="System.Data.SQLite" description=".Net Framework Data Provider for SQLite" type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite" />
    </DbProviderFactories>
</system.data>

I modified both. However to find the exact one which is used by the generator, in your <database>.tt file very near the bottom, un-comment

fileManagement.WriteLine("// " + System.Runtime.InteropServices.RuntimeEnvironment.SystemConfigurationFile);

Save the <database>.tt and inspect the first line in the generated output. I have the following listed:

// C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config

So that is the exact file the generator will use, and is the one that is required to have the above sqlite3 XML added.

Clone this wiki locally