DbConfiguration.SetDatabaseLogFormatter Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Call this method from the constructor of a class derived from DbConfiguration to set a factory for the type of DatabaseLogFormatter to use with Log.
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
protected internal void SetDatabaseLogFormatter (Func<System.Data.Entity.DbContext,Action<string>,System.Data.Entity.Infrastructure.Interception.DatabaseLogFormatter> logFormatterFactory);
member this.SetDatabaseLogFormatter : Func<System.Data.Entity.DbContext, Action<string>, System.Data.Entity.Infrastructure.Interception.DatabaseLogFormatter> -> unit
Protected Friend Sub SetDatabaseLogFormatter (logFormatterFactory As Func(Of DbContext, Action(Of String), DatabaseLogFormatter))
Parameters
- logFormatterFactory
- Func<DbContext,Action<String>,DatabaseLogFormatter>
A delegate that will create formatter instances.
- Attributes
Remarks
Note that setting the type of formatter to use with this method does change the way command are logged when Log is used. It is still necessary to set a TextWriter instance onto Log before any commands will be logged. For more low-level control over logging/interception see IDbCommandInterceptor and DbInterception. This method is provided as a convenient and discoverable way to add configuration to the Entity Framework. Internally it works in the same way as using AddDependencyResolver to add an appropriate resolver for Func<TResult>. This means that, if desired, the same functionality can be achieved using a custom resolver or a resolver backed by an Inversion-of-Control container.
Applies to
Entity Framework