This is an old revision of the document!
The NebolLogger.EntityFramework library adds a Database destination to NebolLogger.
See the nuget page at https://nuget.nebol.se for version history etc.
Despite the name it only supports (currently as of 1.0.0.12) .NET Standard 2.1 and .NET Core 3.0 and 3.1
It creates and uses a couple of tables:
Create the empty database.
EF Migrations do not work (not yet in any case) so you need to create the schema contents either by running the script that is added to your project when installing the package (in the Database Scripts folder) or by calling Database.EnsureCreated() in your startup code.
If there are other tables in your database than the NebolLogger tables, the Database.EnsureCreated() call will fail as it requires an empty table on first call. In that scenario you should use the script.
Install-Package Microsoft.EntityFrameworkCore.SqlServer
static void SetupLogging()
{
var optionsBuilder = new DbContextOptionsBuilder<NebolLoggerDbContext>();
optionsBuilder.UseSqlServer(connection_string);
using (var db = new NebolLoggerDbContext(optionsBuilder.Options))
db.Database.EnsureCreated();
Destination_Database db_dest = new Destination_Database(optionsBuilder.Options);
db_dest.Filters.Add(new Filter_Level(LogType.information)); // skip trace messages
Logger.Instance.Destinations.Add(db_dest);
}