entity-framework no context menu in VS2012 - entity-framework

I've installed EntityFramework from VisualStudioGallery to VS2012 but when I mouse over the project, there is NO "Entity Framework" context menu available.
The menu "Manage NuGet Packages" is available over "Resources" and EF Package is installed.
Any ideas?

Maybe you are confused. For add a Entity Model Desing file you need RMouse in the project, select add new and select the option "data" and after select "Ado.Net Entity Data Model".
If you want the option "Entity Framework" in the menu of RMouse you maybe are talking about Entity Power Tools, and for that you need to get that plugin Entity Framework Power Tools
The Entity Power Tools will to enable the option "Entity Framework" in the main menu of the RMouse and is for generate POCO class based in your database.

Try to intall the 2012.2 update http://www.asp.net/vnext.

Related

EF Designer in VS2019 Does not come up

Visual Studio 2019 "EF Designer from database" does not come up.
I have VS2019 with ODT.Net 19.3.2 and Oracle Client 32-bit 11.2g
There is an existing Oracle 11g database on the server for which I have successfully created and tested a connection in Server Explorer.
Now when I try to bring up the "EF Designer from the database", I get this strange behavior where it returns to the first screen in the wizard, like so:
In Solution Explorer, right clicked project -> Add -> New Item.
Select "Data" on the left then "ADO.Net Entity Data Model" on the right. Click "Add" button.
Select "EF Designer from database". Click Next.
Click Next
Returns to 1st screen!!!! EF Designer does not come up!!
I'm suspecting that maybe ODT.Net 19.3 is not compatible with Oracle Client 11.2g?

How to observe database when using Entity Framework 6 with WebAPI 2?

I wanted to know how to view the database when using Entity Framework 6 with Web API 2.
Most tutorials I see show the ability to open the "Server Explorer" or "SQL Object Explorer" window to view "Data Connections", which will show a connection to the database created when deploying the current project that is using Entity Framework. However, when I view these windows and refresh, there is nothing showing under "Data Connections"
I have hit a problem on a current project when trying to use EF6 with relationships in the models and It would help me to debug if I could see what EF has created. Perhaps the tables, sql, or visual class diagrams would be great, but I can't find any of those in the solution.
I can recreate the issue using Visual Studio 2013 with the following steps:
File > New > Project > Visual C# > Web > ASP.NET Web Application
Select WebAPI project template > Click OK
Right click Model folder in solution > Add > Class > Create "Question.cs"
Add add few properties to the model.
Right click Controllers folder in solution > Add > Controller > Web API 2 Controller with Entity Framework
Select Model we created in step 4-5, Create new context "TestContext"
Build project
Now, i'm expecting that the scaffolding done by the steps above creates the TestContext which extends DbContext which defaults to creating a LocalDb instance on my machine. It's my understanding that LocalDb is included with VS 2013 and I have Window 8.1 which should have IIS on it. I'm expecting to be able to see the database created when I build the project.
Is there some settings I need to change to view the database in VS2013 or does the Data Connection only show up if I have SQL server installed?
The only other difference I can see, is that most of the tutorials I reference are using MVC projects and since mine is WebAPI with EF added, perhaps there are some default settings / web.config settings that need to be enabled for me to see the database.
Speaking of web.config I do not see an explicit connection string in the web.config from the TestContext, which I was expecting.
Help is much appreciated.
By default, Entity Framework will use a localdb database.
The actual database file will be created under the AppData folder of the solution.
Initially, the file won't be visible in the Visual Studio solution explorer, as the file is not included in the project.
Clicking the Show All Files button of the Solution Explorer toolbar to view the file.

Entity Framework NuGet package not source-controlled/in TFS?

I mapped my solution (using Entity Framework) onto a new PC. The solution reports a compile error because the EntityFramework.dll can't be found. Digging deeper it seems that TFS only stores the packages/repositories.config file in source control. I'm unable to re-add the Entity Framework as VS2012 reports it as already installed (green tick).
What's the normal process to fix this? Is this a wider issue with source-control and NuGet packages? Should I just add the DLL to source control?
FYI, the HintPath is for the project is: ..\packages\EntityFramework.5.0.0\lib\net45\EntityFramework.dll which of course doesn't exist.
My current workaround is to hack the 'packages.config' to delete the EF item and then go back into the NuGet dialog.
If you right click your solution you should have the option to "Enable NuGet Package Restore" - this should sort your issue out.
You may also need to right click your solution and got to "manage nuget packages etc..." - it may give you an option to restore missing packages.

NuGet Package Manager Console Default Project dropdown is empty

I recently upgraded to Visual Studio 2012 RTM Ultimate from MSDN. I'm using EF Code First Migrations to build my database in my app, and I recently added a new entity and want to scaffold the migration for it.
To do this, you need to open the Package Manage Console window in VS, and type add-migration "some name here". This will scaffold any changes to your database since the last time it was updated.
The Problem
This issue did not occur on VS 2012 RC
The problem I'm encountering is the "Default Project" dropdown in the Package Manager Console is not populated, despite having several projects in my solution. The default project that is used when I just type the command above is the wrong project (my migrations are in another project). I get the following error when I do this:
No migrations configuration type was found in the assembly 'ProjectA'. (In Visual Studio you can use the Enable-Migrations command from Package Manager Console to add a migrations configuration).
What I've Tried
I have tried setting the correct project (ProjectB) as the startup project, only to get this error:
Could not load assembly 'ProjectA'. (If you are using Code First Migrations inside Visual Studio this can happen if the startUp project for your solution does not reference the project that contains your migrations. You can either change the startUp project for your solution or use the -StartUpProjectName parameter.)
The Question
How can I manually specify which project migrations are added to, or force the Default Project dropdown to populate?
In VS 2015, I just restarted the IDE and the dropdown was filled again.
I was able to manually specify the project by using the following:
add-migration "Locations" -StartupProjectName "ProjectA" -ProjectName "ProjectB"
The documentation for this command is sparse, so here's what I assume is happening:
-StartupProjectName specifies the project where the database configuration is stored (an MVC4 project in my case)
-ProjectName specifies the project where the migrations are to be scaffolded.
I had ProjectB set as the startup project in my app due to testing for this question, but I think you can omit -StartupProjectName if the correct project is set as a startup project in VS.
Close the IDE and open again may help. It worked on my VS2015
Close the solution and open it again. Closing IDE sometimes takes more time. This works in VS 2017
If anyone is experiencing this issue with Visual Studio 2019 and .NET Core projects this is because the interface lacks a method of adding solution files to the project.
I was able to resolve the issue by using the command line tool as follows:
First navigate to the folder that holds the project and open a (git) bash console window.
Then add a solution file to the folder.
dotnet new sln
Then add a reference to each project to the solution (* will find all solutions)
dotnet sln *.sln add <project-folder-1>/<project-name-1>.csproj
dotnet sln *.sln add <project-folder-2>/<project-name-2>.csproj
N.B. Remember to replace the project folder and the name with what you need.
Close Visual Studio 2019 and reopen.
Nuget Package Manager and console will work as expected.
I had to open the solution.
To view to the solutions, look at the bottom of the "Solution Explorer" pane. There should be a "Team Explorer" tab. Click it. Then in the bottom half of the pane, your solutions should be listed. Double-click on the solution that you want to install things for, or right-click on it and select "Open".
That should open up the Package Manager Console with the correct project pre-selected.
I had to Restore NuGet packages first. Then it showed.
I had a similar issue with Visual Studio 2013. Right clicking on [Solution]->[Properties]->[Startup Project] make sure [Single startup project] is selected. I previously had multiple projects selected for Azure worker role testing.
After existing VS, Package manager worked fine.
first close vs,
then go to setting of your computer, apps & features, microsoft-visual-studio-installer,
modify, In the second tab you will get an option to define which parts of vs you want to use, select whatever belong to nuget.
when it is finished, open the vs again. now it is supposed to work
success!!!
You can select the projects under the Solution explorer .Then it showed up on package manager console . It worked for me
If you see projects under Solution explorer, but default project dropdown is empty, then my 100% precise solution is:
Select all projects under Solution explorer, right click, and REMOVE
Click in SAVE ALL
Now, select Solution explorer and ADD each project to Solution again
After that, You will see all projects added in Package Manager Console's Default Project DropDown.
That's it.

Missing Ado.Net Entity Data Model on Visual Studio 11

Missing "Ado.Net Entity Data Model" on Visual Studio 11, how can i install it?
It's right here - click Add New Item in Solution Explorer, in a suitable project:
What type of project did you want to add it to??