How to use Entity Framework 5.0? - entity-framework

After install EF 5.0, it said:
Successfully installed 'EntityFramework 5.0.0-rc'.
Successfully added 'EntityFramework 5.0.0-rc' to MyWeb.
but my solution has many projects, not only the web project. For example, I have a project MyData which is referenced by MyyWeb. How can use use EF 5.0 in MyData project?

Install the package into each project that needs it. You can do this by right-clicking on each project and selecting Manage packages, or by using the Default Project drop-down inside of the Package Manager Console.

Related

Package manager console Add-Migration command not working

First of all, all other questions here with this problem are for ASP.NET Core projects, and the solution is to add the Microsoft.EntityFrameworkCore.Design to the tools section on project.json, but... I'm not using ASP.NET Core, so I don't have project.json in my project. So please keep it in mind before marking it as duplicate since I saw that's a fairly common question...
When I type add-migration InitialMigration on Package Manager Console I get the following error:
Cannot execute this command because Microsoft.EntityFrameworkCore.Design is not installed. Install the version of that package that matches the installed version of Microsoft.EntityFrameworkCore and try again.
But as you can see on the image bellow, it is installed on this project:
My database layer is in a separated project, which is Full Framework ClassLibrary, and because of this I don't have a projec.json file.
Does anyone tried to use migrations on class libraries projects?
In dotnet core this is typically due to the fact that you're missing a package. Go into the NuGet Package Manager on the solution level and install Microsoft.EntityFrameworkCore.Tools for your project.

Could not install package 'NuGet.Client 3.2.0'

I'm working with RESTful webservice, getting error while adding package "System.Net.Http";
"The 'System.Net.Http 4.0.0' package requires NuGet client version '3.0' or above, but the current NuGet version is '2.8.5.0'. "
So, to resolve above error i'm trying to install "NuGet client" from "Add Package" option in xamarin studio, but this time I'm facing another issue that is;
"Could not install package 'NuGet.Client 3.2.0'. You are trying to install this package into a project that targets 'portable-net45+win+wp80+MonoAndroid10+xamarinios10+MonoTouch10', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author."
please help to resolve this issue.
Xamarin Studio currently does not support NuGet 3. It is currently only supported in Visual Studio 2015.
It is not possible to upgrade Xamarin Studio so it supports NuGet 3 at this time. Installing the NuGet.Client NuGet package does not upgrade NuGet in Xamarin Studio.
I would instead look at using the Microsoft.Net.Http NuGet package which you can install into a portable class library project (PCL) and supports all Xamarin Android and Xamarin iOS projects.
I was able to grab a copy of System.Net.Http.dll from another project and manually add it as a reference to my Xamarin project. I put it in the packages folder and then browsed to it from the edit references dialog.
For people facing problem trying to add System.Net.Http...
I was able to solve the problem by using Microsoft.Net.Http instead of System.Net.Http. In Xamarin studio, Right click on your project > Add > Add NuGet Packages.. > search for "Microsoft Http Client Libraries" and click Add Package.

upgrade the project from ef4.3 to ef5

I have a project which is using EF4.3, is it possible to upgrade it to EF5? This is, so I can use the new features. My IDE is VS2012.
You can nuget the new package, it should replace your existing .dlls. See the Entity Framework nuget package site.
In package manager console enter:
Install-Package EntityFramework

Entity Framework 4.3 Multi-project installation

I'm confused with regards to my code using latest Entety Framework.
I have 2 projects in the solution. I've used t4 templates to generate Self-Tracking Entities.
In project #1 I have just .edmx files and Entety Framework 4.3 installed thru NuGet PM. Now my second project has template-generated Context classes. So how do I make sure my second project also uses EF 4.3? Do I need to install it separatly for every project in my solution or can I just reference EntityFramework.dll? Thanks.
The Entity Framework package installation is project specific. I'd install it separately, so NuGet can manage the references.
To manage the package installation for multiple projects, open NuGet PM for Solution with
"Tools->Library Package Manager->Nuget Package Manager for Solution..."
Go to the Installed tab (or Online), select EntityFramework and click Manage. Check/Uncheck the projects where to install EntityFramework.
Or, in the console pass the -ProjectName property to the install-package command.

Referencing a .net 3.5 version of a nuget package from a .net 4 project

I want to make my .net 4 project load the .net 3.5 version of a nuget package so that other .net 3.5 references don't get the nuget dll overwritten in the output directory.
Yikes! If the package has a .NET 3.5 and a .NET 4 version of the DLL, there's no real way to do that other than changing your project to target 3.5 itself.
I can think of a couple of workarounds though. They're not ideal, but they'd probably work.
After you install the nuget package, go into the "packages" directory (it'll be next to your solution (.sln) file. Find the package. Delete the "\lib\net40" folder. This way, NuGet will reference the next version down. You'll have to manually change the assembly reference. Note if you even upgrade this package, you'll have to do this again.
You could create a custom version of this package that only contains your 3.5 version of the DLL. Perhaps put this up in a custom feed at http://myget.org/ and install it from there.
One of those ought to work.