In NLog, to target a database for logging, you just enter the database connection, etc an开发者_如何学Pythond it connects straight to the db and does its stuff. My project uses the repository pattern, which all access to the db goes through the repository. How do I setup NLog to log to my database using the repository? Should I create an ILoggingRepository
? How do I use this in the NLog configuration?
Or should NLog be doing its connection straight to the db because its a logging framework?
It's good that you are abstracting with a data access layer. However the repository pattern is meant/intended for your domain objects. Think of logging as service and not as a domain object. Logging can be persisted to various locations. Don't create an ILoggingRepository. Just configure NLog to persist to the db directly.
精彩评论