Entity Framework Extensions – Log

Log Options

Log

Allow you to log some event happening in your database.

Example

StringBuilder logger = new StringBuilder();
using (var ctx = new EntitiesContext())
{
ctx.BulkSaveChanges(operation =>
{
operation.Log += s => logger.AppendLine(s);
});
}

UseLogDump

Allow you to log in a string (LogDump) event happening in your database.

Example

StringBuilder logDump;
using (var ctx = new EntitiesContext())
{
ctx.BulkSaveChanges(operation =>
{
operation.UseLogDump = true;
operation.BulkOperationExecuting = bulkOperation => logDump = bulkOperation.LogDump;
});
}

LogDump

Allow you to retrieve event happening in your database when UseLogDump is enabled.

Example

StringBuilder logDump;
using (var ctx = new EntitiesContext())
{
ctx.BulkSaveChanges(operation =>
{
operation.UseLogDump = true;
operation.BulkOperationExecuting = bulkOperation => logDump = bulkOperation.LogDump;
});
}