Log4NetAdoNetAppender icon indicating copy to clipboard operation
Log4NetAdoNetAppender copied to clipboard

I think you can add support for sqlite databases

Open Jamnine opened this issue 2 years ago • 4 comments

For the test environment, sqlite testing will be more convenient. The production environment will be directly switched to mssql. With the sqlsugat orm framework, you can see the record results after downloading the code and running it directly to avoid generating a pile of mssql

Jamnine avatar Nov 23 '22 02:11 Jamnine

https://github.com/microknights/Log4NetAdoNetAppender/issues/23 Oh, I see it seems that someone has raised this question. I test the support of sqlite

Jamnine avatar Nov 23 '22 02:11 Jamnine

#23 is a few years old, so with a little bit of luck It should work now.

Post a status back if it works, for others crossing this issue.

microknights avatar Nov 23 '22 15:11 microknights

The test found that sqlite can be used

I tested that both net core 3.1 and net 6 can be used

Attach the test configuration file. If possible, I can submit the test program to PR, including the relevant test demo

Net Core 3.1

  • add
    <PackageReference Include="Microsoft.Data.Sqlite" Version="3.1.9" />

connectionString Or connectionStringFile

  • connectionString
    <connectionType value="Microsoft.Data.Sqlite.SqliteConnection, Microsoft.Data.Sqlite, Version=3.1.9.0, Culture=neutral, PublicKeyToken=adb9793829ddae60" />
    <connectionStringName value="sqlite" />
    <connectionString value="Data Source=log4net.db" />
  • connectionStringFile
    <connectionType value="Microsoft.Data.Sqlite.SqliteConnection, Microsoft.Data.Sqlite, Version=3.1.9.0, Culture=neutral, PublicKeyToken=adb9793829ddae60" />
    <connectionStringName value="sqlite" />
    <connectionStringFile value="connectionstrings.json" />

    ###connectionstrings.json
    {
      "connectionstrings": {
        "sqlite": "Data Source=\"./log4net.db\""
      }
    }

Net 6

  • add
    <PackageReference Include="Microsoft.Data.Sqlite" Version="7.0.0" />
    <PackageReference Include="Microsoft.Data.Sqlite.Core" Version="7.0.0" />

connectionString Or connectionStringFile

  • connectionString
    <connectionType value="Microsoft.Data.Sqlite.SqliteConnection, Microsoft.Data.Sqlite, Version=7.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60" />
    <connectionStringName value="sqlite" />
    <connectionString value="Data Source=log4net.db" />
  • connectionStringFile
    <connectionType value="Microsoft.Data.Sqlite.SqliteConnection, Microsoft.Data.Sqlite, Version=7.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60" />
    <connectionStringName value="sqlite" />
    <connectionStringFile value="connectionstrings.json" />

    ###connectionstrings.json
    {
      "connectionstrings": {
        "sqlite": "Data Source=\"./log4net.db\""
      }
    }

Jamnine avatar Nov 24 '22 06:11 Jamnine

Yes, a PR with tests for sqlite will be cool.

Great work 👍

microknights avatar Nov 24 '22 07:11 microknights