I can't open .EDMX files in the Entity Data Model designer - entity-framework

I can't find the ADO.NET Entity Data Model in Visual Studio 2012. When I open EDMX it opens in XML only not in designer. When trying to add new item to a project I don't find ADO.NET under Data tab.
I tried almost all solutions proposed on the net but no result:
I removed EF5 and installed EF 6.2 but the problem persist.
I tried to install VS2012 Updates but no change.
Repairing current install no change.
I tried to find ADONETEntityFrameworkTools_enu.msi in the install media but can't find it. -
I tried all other solutions but not working.

I've figured out the problem : when i run ETool.msi from Install Media for repair,
it was an older ver. (EF.4) than the currently installed ver. (EF.6) so it wasn't working.
So i downloaded EFTool ver.6 (same ver. of installed EF) ,run Repair command and it fixed the problem

I had the same problem but perhaps in reverse. I uninstalled VS 2012, reinstalled and when I opened up my v4 EF model it opened in XML rather than the designer.
I uninstalled the EF Designer for VS from the Control Panel, ran EFTools.msi from the installation media and everything was fine.
Perhaps a version compatibility issue like Hussein's.

you should add both EntityFrameWork.dll and EntityFrameWork.SqlServer.dll to your project

Related

Visual Studio Ultimate 2013 crashes when using Entity Framework Power Tools Beta 4

I'm running VS Ultimate 2013 on a Windows 8.1 machine and have been successfully for several months now. However, I just installed the NuGet package for Entity Framework Power Tools Beta 4 today and am having issues. After installing EFPT, I restarted VS, loaded my solution, made my "data" project the startup project, right-clicked on my class deriving from DbContext -> Entity Framework -> Generate Views. Visual Studio completely crashes and restarts. I've tried clicking on other options in in the EFPT context menu such as "View Entity Data Model (read-only)" and all of them results in VS completely crashing and restarting.
I was running VS with Update 3, so I installed Update 4 and still the same issue. It does NOT crash if running devenv.exe in safemode, but EFPT doesn't actually DO anything either.
So now, I'm running VS version 12.0.31101.00 Update 4 with .NET Fx 4.5.51641 and Entity Framework 6.1.2.
Ultimately, I'm trying to create a EDM mapping file for my code-first EF context to cache and reduce startup time. If this issue I'm having is a known issue, is there a fix OR a workaround in generating this mapping???
Thank you Erik. I wanted to answer my own question because I was able to take it a step further. Rather than writing (a LOT) of code to generate cached views and having to run it every time your code changes.
A dev on the SignalR team at Microsoft, Pawel Kadluczka, wrote a nice and EASY-TO-USE bit of code that can be installed via NuGet. The "Interactive Pre-Generated Views" project, when added to your data assembly, will look for cached views and if not found, generate them on the fly. Out of the box, it supports both file and db cached view info.
The only bit of code I had to add to utilize this was:
static DynamicDbContext()
{
InteractiveViews.SetViewCacheFactory(new DynamicDbContext(), new FileViewCacheFactory(_SCRIPT_DIRECTORY + "dbviews.xml"));
}
It literally took me 5 minutes to install, write the bit of code, execute and confirm.
It needs to run prior to any query being executed with your dbcontext and so he recommends this bit of code to be placed in a static ctor of your custom dbContext.
Pawel's blog post where he describes it is: http://blog.3d-logic.com/2013/12/14/using-pre-generated-views-without-having-to-pre-generate-views-ef6/
You can install via NuGet or read more about it on CodePlex: https://efinteractiveviews.codeplex.com/

Integrating Entity Framework 6.0 with Postgres 9.3

I have a local database developed in Postgres 9.3. The Postgres server name on my computer is just "localhost". I would like to use the Entity Framework 6 Designer that is built into Visual Studio 13 to automatically generate a data model of EF classes and properties that correspond to the database tables and columns.
As described in various web articles, and using Nuget package manager, I added onto VS 13 these extensions or packages: EF 6, Npgsql, Npgsql Data Provider for EF 6, and Dotconnect express for Postgresql. Afterwards, in the VS 13 Server Explorer window, I was able to connect and see my Postgres tables and columns.
However, I cannot seem to get the EF Designer Wizard to automatically generate the .edmx file. I tried adding an ADO.net data object, selecting "EF Designer from Database" and alternatively, "Code First from Database." When I got to the next screen, I had to choose a Data Source. I tried both "MS SQL Server Database File" and alternatively, "Other." For the Data Provider, there was no other option than ".Net Data Provider for SQL."
In the next screen I tried to create a connection, using SQL server authentication, with user name and password, but I could never get VS 13 to connect or even display the Postgres server like it did in Server Explorer window. For the Server Name I used the same one as I used for the Server Explorer window, ie. localhost.mydatabasename.myschema. For the SQL User, I used the owner of the Postgres database, a Role I created, ie. mydatabasename_role.
When that faied, I tried going into MS SQL Management Studio 2014 to see if I could display the Postgres server there, using the same info used in the Server Explorer window, but I could not get SSMS to display the Postgres server there either. Is there a way to automatically generate the data model and .edmx file as I have been trying, using just VS 13 and SSMS 14? Or do I need to purchase the proprietary / licensed version of dotconnect for Postgres developed by Devart? Thank you in advance.
A Visual Studio plugin is currently being developed which supports the EF Designer Wizard.
You can find it here: https://github.com/npgsql/Npgsql/pull/213
After about a week of research and banging my head againts my desk, I FINALLY got my Npgsql MVC Entity Framework application to work... and work WITH the wizard. The steps are below....
1) Close Visual Studio, then download and install Npgsql PostgreSQL Integration from: https://marketplace.visualstudio.com/items?itemName=RojanskyS.NpgsqlPostgreSQLIntegration
2) Reboot your computer. (yes, it's needed, I promise)
3) Open visual studio and install the following NuGet packages, IN THE ORDER listed and the VERSION listed...
--> EntityFramework version 6.0.0, then clean and rebuild
--> Npgsql 3.1.0, then clean and rebuild
--> EntityFramework6.Npgsql 3.1.1, then clean and rebuild
NOTE: You may need to uninstall other Nuget packages if these will not install in the order and version listed. If so, just make note and add them back later. and yes, you will want to clean/rebuild between each one above.
4) Close all applications and restart your computer. (yes, it's needed, I promise)
5) After your computer restarts, open Visual Studio again and go to your solution. NOTE: I advise you add a new project for your database connection, but this is more a preference than anything.
6) Try using the Entity Framework Wizard again. You should see the Npgsql selections and it shouldn't just crash on you.

When SQL isn't explicitly installed what is the default data store Visual Studio 2012 and/or Entity Framework 5/6?

I have the situation below and can't figure out where everything is being saved.
I'm using a new installation of Visual Studio 2012 and didn't explicitly install any version of SQL. I created a Console project in VS and used NuGet to add references to the latest -Pre version of EF (6.0.1 at the time).
When I did the database operations I wanted (just some test stuff: create, add, query, migrations, etc.) everything worked. Shutdown the application, bring it back up and the data was persisted correctly. No problem so far.
When I went to look at the database I was surprised to find that I didn't have Management Studio installed. I also wasn't able to see any databases in the SQL Server Object Explorer in VS2012. I could see a "(localdb)\Projects" server but my database wasn't in it.
When I checked the generated connection string it was:
Data Source=.\SQLEXPRESS;Initial Catalog=TestProject.Context;Integrated Security=True;MultipleActiveResultSets=True
Using add server in the SQL Server Object Explorer I had to manually enter server names since none were found automatically. I tried localhost\SQLEXPRESS, (localdb)\SQLSERVER, .\SQLEXPRESS, and other similar variants, but those couldn't be found either.
Where is everything being saved?
Thanks.
If SqlExpress is not installed the default is (localdb)\v11.0 which is installed when you install VS2012 (or VS2013).

Entity framework starter kit on VS 2012

I have downloaded and installed the Entity Designer Starter Kit on both VS 2010 and 2012. I've created a project and have customized that project to allow me to add (for now) three attributes for each field value: See Below: (I'd post the image but I've only started posting here and I don't have 10 points) :(
As you can't see above, the Extension is working...on VS 2010, however, we need to use VS 2012 - so we can have the new support for geography fields in our Model, but it doesn't seem to work in VS 2012. The extension shows up as an installed extension in the Extension Manager in both versions, but doesn't work (or do anything in 2012.) when we build a new Model or open an existing one. :(
I've looked at the manifest for versioning info, and it DOES show up in the Extension Manager as having been installed (in both versions). (See part of Manifest below -- We are using the Professional version of 2012)
<SupportedProducts>
<VisualStudio Version="11.0">
<Edition>VSTS</Edition>
<Edition>VSTD</Edition>
<Edition>Pro</Edition>
<Edition>Express_All</Edition>
</VisualStudio>
<VisualStudio Version="10.0">
<Edition>VSTS</Edition>
<Edition>VSTD</Edition>
<Edition>Pro</Edition>
<Edition>Express_All</Edition>
</VisualStudio>
</SupportedProducts>
Does anyone have any idea why its not running in 2012?
Thanks for any help!!!!!!!
bob
Back in 2010 I found that the Starter Kit did not work, perhaps due to the version being for VS2010 RC.
So I rebuilt it, and today, I've just upgraded it to VS2012.
So you can get it from my Blog.
All I did was run it though the VS upgrade wizard, and then change the manifest to VS2012 and it worked fine. Perhaps you could explain a little more "geography fields", as I've not read up yet on any of the changes in VS2012.
http://www.jsrsoft.co.uk/blog/post/Entity-Framework-Starter-Kit-alternative

How to remove EF 4.2 and reset my Visual studio

I installed a lot of ado.net entity framework versions and tools. one of them was this one: http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=26660
Now there are a lot of problems while trying to add a new entity data model, and also can't use any code generation tools such as dbcontext code generator.
What I want to know is how to remove all of these ef versions and reset my Visual studio 10.
Note, I repaired my vs, and reinstalled the SP1 but with no hope, the same errors are there.
here are 2 screen shots that may let you help me better:
installed items in my VS:
error appear after trying to add a new entity data model:
The uninstallation procedure of EF June 2011 CTP is described in this article. As you see in your linked download page there is red text in instructions describing issues with CTP. That CTP should have never been installed on your main development (production) machine because it breaks existing VS functionalities. The instructions directly says that it should be installed in non-production environment (for example virtual machine).