Using Entity Framework 3.5 AND 4.0 in the Same Project
I'm wondering if using VS.Net 2010, I can have Entity Framework 3.5 code running along side 4.0 code. I have a project that I'm working on, some of it is currently written using EF 3.5. I'd like to start using EF 4.0 for anything new we add to the project, and convert the 开发者_运维百科EF 3.5 stuff over a little at a time. Is it feasible to run the two side by side in the same project?
Thanks in advance.
Convert assembly with your EF code from .NET 3.5 to .NET 4.0 (EFv1 to EFv4 - should be automatic) and start to add new features - that is the only feasible way to do it. As mentioned in other answer you can't run two .NET versions in single project. Using EFv1 and EFv4 side by side will require second project with separate EDMX etc. Merging these projects later will add additional work and more complexity than converting your current version.
Not in the same project unfortunately. Framework version selection is on a project level, so you'll have to separate your 4.0 code into a separate project and reference it from 3.5 one.
You can implement .Net 4 higher up your stack like UI and still use .Net 3.5 at lower levels like data access or business layer.
You can't however use .Net 4 at lower levels like data access or business layer and .Net 3.5 at the UI unless the change in CLR boundry is separated by something like WCF allowing each to run in their own AppDomain. Attempts to use .Net 3.5 references from .Net 4 will result in compile errors saying dll not present.
精彩评论