Is there a way to make the EFTracing provider work with EF 4.1?
EFTracing seems to need an objectcontext and I use dbcontext.
Thanks in advance!
If you are using DBContext and MVC Model First, meaning using EntityConnections then the following sample code should be all you need:
public partial class BrickHouseFitnessContext : DbContext
{
public BrickHouseFitnessContext(): base(EntityConnectionWrapperUtils.CreateEntityConnectionWithWrappers(ConfigurationManager.ConnectionStrings["BrickHouseFitnessContext"].ConnectionString, "EFTracingProvider"), true)
{
}
Also:
In the Web.Config file add the following sections:
and:
There is no need to include the ExtendedEntities or the other ObjectContext derived class mentioned in the original article. Run that code and you should see your log file as specified, with all the SQL commands in it. I am bypassing database intialization when tracing is enabled,