In entity framework 6.0, the Database class has a property Action<string> Log
. so setting up logging is as easy as:
context.Database.Log = Console.WriteLine;
For more advanced needs you can set up an interceptor.
More Related Contents:
- Fastest Way of Inserting in Entity Framework
- One DbContext per web request… why?
- Entering keys manually with Entity Framework
- The entity type is not part of the model for the current context
- Validation failed for one or more entities while saving changes to SQL Server Database using Entity Framework
- LINQ to Entities only supports casting EDM primitive or enumeration types with IEntity interface
- LINQ to SQL multiple tables left outer join
- Entity Framework error: Cannot insert explicit value for identity column in table
- Entity Framework. Delete all rows in table
- Entity Framework – stored procedure return value
- EF 6 Parameter Sniffing
- The operation cannot be completed because the DbContext has been disposed using MVC 4
- Configure multiple database Entity Framework 6
- Retrieve an object from entityframework without ONE field
- Join and Include in Entity Framework
- Anonymous type result from sql query execution entity framework
- DbContext discard changes without disposing
- Can you get the DbContext from a DbSet?
- How to Refresh DbContext
- Calling a SQL User-defined function in a LINQ query
- NSubstitute DbSet / IQueryable
- Stored procedure returns int instead of result set
- How to use String property as primary key in Entity Framework
- Querying data using Entity Framework from dynamically created table
- Query extremely slow in code but fast in SSMS
- Entity-framework code is slow when using Include() many times
- Can we have table without primary key in entity framework?
- ASP.NET Core API only returning first result of list
- How do I extract data from a DataTable?
- How to include() nested child entity in linq