Upgrading Entity Framework 1 Project to EF 4 - entity-framework

I currently have a project using EF 1 (.NET 3.5) and would like to move it to the latest and greatest EF version.
I am actually quite happy with the feature set of EF1. The main reason, I want to do this is because I'm moving my frontend from webforms (.NET 3.5) to ASP.NET MVC 3 using Razor as the viewing engine.
I know I can simply change the target framework from 3.5 to 4. But usually these simple upgrade solutions usually result in problems at a later stage. e.g. is there still legacy code in the model? Would I be loosing functionality?

After the migration:
The migration went really smooth. No hickups whatsoever. Simply upgrade the project and your done.

Related

Can't configure Entity Data Source to work with Entity Framework 6

I'm trying to use Entity Data Source Control to access my database first Entity Framework model but I can't get it to work with Entity framework 6. It gives me an error saying its not compatible with Entity Framework 6 and instead directed me to install Microsoft.AspNet.EntityDataSource from Nuget which I've done. but for some reason I can't configure it using the wizard. In design view, it doesn't show the little arrow to open the smart tasks panel.
I'm new to ASP.NET and don't know how to configure it in markup view
which data source (or perhaps another technique) should I use to access data objects in Entity Framework 6?
I don't think you can use the wizard to configure EF6 EntiyDataSourceControl. The wizard only works with EF5. You need to configure the EF6 EntityDataSourceControl in code. Here is a corresponding ticket.
I have gone through same situation as yours.Finally this solved the issue,
Uninstalled EF6 and installed version 5 of Entity Framework through Nuget Package Manager Console, then it worked fine

Upgrading Entity Framework

I have a Data Access Layer solution built in Visual Studio 2010. It uses Entity Data Model (.edmx files) to create object models of the data.
It is built with .Net 3.5 framework so I assume this is also version 3.5 of Entity Framework?
We use a number of TVFs to return datasets and unfortunately EF 3.5 does not provide access to TVFs. So we have has to build tsql views that call those TVFs.
Is it possible to upgrade this solution to EF 6 and use TVFs? What are the steps involved?
Microsoft has release a guide to do. You find it here:
https://msdn.microsoft.com/en-us/data/upgradeef6.aspx
It involves getting the latest assemblies and do some modifications in order to run. It seems upgrading from an older version is a little harder than from a new version.

Using Entity Framework 6 with EntityKey

I am trying to upgrade a big data project from EF 5 to EF 6. But when I run the code generation in EF6 tool the references to the related tables are no longer there.
So the following line of code no longer works.
dbTradeAllocation.ChargeTypeReference.EntityKey = new EntityKey("ICEEntities.SystemData", "ID", TradeAllocation.ChargeType);
Does anyone know if EntityKeys are still supported in EF6 ?
Thanks Paul
EntityKey is supported in EF6. However you cannot run EF5 code generation in EF6 - it won't work since there were changes in namespaces. I touched a little bit on this in my blog post about changes to EF Tooling in VS2013 - you can find the blog post here. If you want to use EntityObject/ObjectContext entities in EF6 you need to use EntityObject generator for EF6 which you can get from VS Gallery (note it requires .NET Framework 4.5 on the dev box).

Entity Framework Pre-Generated View on Assembly

I just started using EF 6 and I noticed that the first execution takes more time because it needs to be compiled, so I researched and found that you can pre-generate the view.
I used EF Power Tool to generate the view: http://visualstudiogallery.msdn.microsoft.com/72a60b14-1581-4b9b-89f2-846072eff19d/
It's a dll, and I'm building using the option Embed in Output Assembly.
The problem is that even though I have the view.cs when I execute the first query I have the same delay, so it seems that my library is not using the pre-generated view.
What could be wrong? I'm passing the connection to the entity using an EntityConnectionStringBuilder returning a EntityConnection object.
Also I tried changing the view.cs to Embedded Resource, since with Compile I did not have any changes, in both ways I still have the first time delay.
I'm sure I'm missing something, but not sure what.
Thanks in advance,
Lucas.
EF5 views will not work with EF6 (in addition to that there are some issues with EF6 Beta 1 and EF6 RC1 which prevent using views with EF6 - these issues should be fixed for EF6 RTM). I created a T4 template for generating views for EF6 - you can find more details here - again due to the problems above the views generated by the template will not work for EF6 RC1. If you absolutely think you need it you can try the version from my github - it was updated to work with EF6 RTM and also works with nightly builds.
Anyways, I am pretty sure that this is actually not view generation that are causing the issues (actually the performance of view generation in EF6 has been greatly improved). We recently found a few performance issues (see 1674 and 1662) that are affecting start up time and we are looking at these.
EDIT
The version of the template that works with EF6 RTM (6.0.0.0, 6.0.1.0) has been published to the VS Gallery

Is EF4 "Code Only" ready for production use?

I've been looking at the new Entity Framework 4 Code Only features, and I really like them. But I'm having a hard time finding good resource on the feature. Everything seems to be spread around blongs here and there, so this make me wonder if it's ready to be used for a serious project?
What do you think? Is it ready for production use or should I use the more traditional approach (EDMX designer, POCO objects)?
Also, I would like to know if there are any features that Code Only does not support yet, compared to the EDMX designer?
What do you think about the Code Only feature? Is it "mature" yet?
Thank you.
It depends when your project should be ready. Code First (Code Only) is only in CTP3 without go-live license. As I've read, there is no exact timeframe for the Feature Pack Where is EntityConfiguration in EF4 VS 2010 RTM? and it will be published when it will be ready (no release date). According to the blog of EF team it will be available in the next framework release.
Code First is still under active
development and will have some
breaking changes so there is no
go-live licence at this time.
Link
Code First = Code Only
In my projects I went with EF + POCO for now.
If anyone is still looking for an answer to this, Entity Framework V4.1 which has the "Code first" feature has been RTW (released to web) for production use since a month and a half now.
You need .Net 4.0 RTM in order to install it. Once you have that installed, you can download the stand-alone installer for EF4.1 from here.