Upgrading Entity Framework - 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.

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

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).

How to get spatial types working in EF?

I have a table with a SQL Geometry column. Now I'm trying to work with EF but the mapper doesn't want to include it (it should be supported by now, as I saw here). Also, I can't find the Spatial Types in the EF Designer as I saw here.
I have done so far:
PM> Install-Package EntityFramework –IncludePrerelease
'EntityFramework 5.0.0-beta2' already installed.
MyProject already has a reference to 'EntityFramework 5.0.0-beta2'.
and after this, the version of the referenced EnitiyFramework.dll is:
4.4.0.0
Sadly, if you are targeting .net 4, it would not work: Some features are only available when writing an application that targets .NET 4.5. This includes enum support, spatial data types, table-valued functions and the performance improvements. If you are targeting .NET 4.0 you still get all the bug fixes and other minor improvements.
source: http://blogs.msdn.com/b/adonet/archive/2012/03/22/ef5-beta-2-available-on-nuget.aspx
Also, if you are targeting 4.5, look here: How to get enums working in mvc4 with Entity Framework 5 Beta 2?

Upgrading Entity Framework 1 Project to EF 4

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.

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.