The question is quite simple: Is it possible to use
Entity Framework 7 (beta4) with
ASP.NET 4.6 (Web Api in my case)?
For the moment I cannot make it work, the following exception is always raised:
An exception of type
System.InvalidCastExceptionoccured in Microsoft.Framework.DependencyInjection.Interfaces.dll but was not handled in user code.
Additional information: Unable to cast object of type Microsoft.Framework.Logging.LoggerFactory to type Microsoft.Framework.Logging.ILoggerFactory.
This error is quite strange since I do not use any logging functionnality of EF 7. It has maybe something with registration to do? I read that with ASP.NET 5, you have to register EF like this:
services.AddEntityFramework(), which I'm currently not doing since I'm using Version 4.6...
This is a possibly likely a bug in EF 7. The issue is being tracked here aspnet/EntityFramework#2606.
As a workaround, try using the nightly builds and make sure that you have the latest versions of both EF 7, Microsoft.Framework.DependencyInjection, and Microsoft.Framework.Logging.