Log4NetAdoNetAppender
Log4NetAdoNetAppender copied to clipboard
I think you can add support for sqlite databases
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
https://github.com/microknights/Log4NetAdoNetAppender/issues/23 Oh, I see it seems that someone has raised this question. I test the support of sqlite
#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.
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\""
}
}
Yes, a PR with tests for sqlite will be cool.
Great work 👍