This is not possible, I have talked to several SharePoint Team members on the same subject and the answer is always the same. I had my own attempts to do it by hand and after bypassing about 20 errors with web.config (and even machine.config) tweaks I hit a dead end.
You need to host your application under another application pool and use some sort of remote call to integrate (WCF, SOAP, Client OM) but you might hit a wall if you get into integrated authentication.
In another attempt to have EF4.0 available for our projects instead of the buggy 1.0 contained in the 3.5 Framework I was testing a little framework in these lines:
- DB > EF4 Project > Repository > WCF Thin Layer under 4.0 Pool
- SharePoint Project > Application Layer (talks to WCF) > SharePoint Application Page > User
The complexity hammer came in and since WCF transport of more deep entity graphs is not trivial nor transparent, we ended up dropping the idea and had to stick with EF1.0 for now (improved with custom adapters to implement things like Lazy Loading and a few DDD patterns).
All this brain melting because the Framework Team and SharePoint Team don't talk to each other, really.
Hope this helps.