c# - Log to database with EF Code First -
i have log4net log database. have added adonetappender
written in docs . docs give definition log-table create. since using entity framework code first , recreating database quite (dropcreatedatabasealways
) during development, don't want manually create table. tried create class log
instead matches definition in docs.
public class log { public int id { get; set; } public datetime date { get; set; } public string thread { get; set; } public string level { get; set; } public string logger { get; set; } public string message { get; set; } public string exception { get; set; } }
however, when using adonetappender
error seems unrelated
cannot drop database "aspnet-mydb-20150625044347" because in use.
but disappears if take out adonetappender
.
how can log database entity framework code first? thank help.
the answer here may solve problem. main issue database still has open connection.
short clip use pooling=false
. being in development should not need pooling.
i know answers links discouraged link answer think safe here.
hope helps
Comments
Post a Comment