how to open edmx file in design view? - c#-3.0

Can someone please suggest that how can I open edmx file in design view. This is evrytime opening in XML view?

Right-click on the item and select "Open With..." - that should offer you the designer. You can also set the default from that dialog too.
I assume you're using a version of Visual Studio which supports the EDMX designer...

If it doesn't open it automatically, you probably don't have the SQL Server Data Tools installed.
You need to modify your Visual Studio 2012 install and select SQL Server Data Tools from the optional features list, which includes the EF Designer.
Or, here's a link to get it directly.

What is the source of your EDMX file?
If your file is from the $metadata endpoint of an OData service, then you can't open it in Visual Studio's EDM Designer. The OData metadata format is indeed EDMX but it is not compatible with Entity Framework's EDMX format.

Related

Is there any fastest method to update edmx?

I am using Sqlserver 2008 . I want to generate or update edmx. it take 8-15 minute to generate edmx. is there is any tool to create edmx fast?
I have a tool that works with VS2008, VS2010, VS2012, and VS2013, that can do both full and incremental updates of EDMX files. It doesn't work with VS2015 though, as development has been on ice for a while, and VS2015 don't support the same integration interfaces as previous versions of Visual Studio.
You can download it from https://huagati.com/edmxtools/ (free nowadays), and there's a screencast showing the functionality I think you are looking for at https://www.youtube.com/watch?v=doqYOlcEAZM
I don't know any way to generate EDMX model besides the "Update Model from database" approach. However, from my own experience, if your model is too big, you have 2 options:
Split your current model into several parts (Microsoft recommends 50 entities per model); or
Use Code-First instead of EDMX
Hope it helps!

How to open edmx? Where to get LINQ to Entities?

After Visual Studio 2013 reinstall I can't open / create edmx files
So I think I should download LINQ to Entities somewhere because I already used to try a lot of Entity related stuff...
Where can I get edmx designer for Visual Studio 2013?
Here's the link to the Entity Framework 6.0.2 Tools for Visual Studio 2012 & 2013:
http://www.microsoft.com/en-us/download/details.aspx?id=40762#
Edit:
Right-click on your project, select Add, select New Item...
Select Data from the left pane, select ADO.NET Entity Data Model, click **Add*
Select Empty Model and then click Finish
This should bring you to the Entity Data Model Designer where you can drag and drop entities and create relationships.

Visual Studio 2013 and Entity Framework

I'm using VS 2013 and SQL Svr 2012 and trying use EF to populate a gridview. As this is a very simple test, I have just one table with a key and a couple of data fields. The process of creating the model seems to work fine - it shows as expected in the designer view, the files are created in app_code, a bin folder is created with 2 dlls, and the config file is updated with a connection string and other entries.
When I try to select the "named connection" I get the error "Unable to load the specified metadata resource" and it talks about rebuilding the project to get the assemblies.
I've spent hours reading other cases like this and I can't understand:
Why this is happening when it was never a problem with VS 2010
How do I fix the connection string to point to the resources it wants. I'm totally lost with all the technical advice about fully qualified assembly names - nothing I try works.
How do I set some parameter to force the resources to be in the proper place? All the advice I've read doesn't seem to relate very well with VS 2013
I need to decide if I should just uninstall VS 2013 and use VS 2012. Currently, I'm using VS 2010 with ASP 4.0 and I'd like to move to ASP 4.5 and generally keep up with Microsoft technology. However, I don't have the skill level to deal with a VS release that is buggy. It seems to me that this EF execise could be due to a either a bug or some odd corruption on my computer - I'm trying to figure out which is the case. I installed VS 2013 Express and SQL Svr 2012 on a clean machine that had none of these tools in the past.
I'd really like to see someone who is very familiar with Visual Studio try to replicate my problem as it only takes a few minutes to do so:
In MS SQL Server, create a tiny DB with one table that has a primary key and a couple of data fields and populate with some test data - Call it TinyDB with TestTable1.
Using VS 2013 Express for Web, create an "New Web Site" with the option for "ASP Empty Web Site" using VB.
Add an ASP App_Code Folder containing an "ADO.Net Entity Data Model" and leave the name as "Model".
Generate the model from the DB and make a "New Connection" for "TinyDB" and using Entity Framework 6.0 and then select "TestTable1". Note the namespace is "TinyDBModel". Clicking "Finish" will generate several items in App_Code, other folders and also update web.config.
Add a web form called default.aspx and drag a gridview onto it. In design mode for the gridview, select "new data source" and then the "Entity" option (note name of EntityDataSource1 which appears in default.aspx). Click next and under "named connection" select "TinyDBEntities" - this is where mine gets the error "Unable to load the specified metadata resource".
Note that this exact exercise in VS 2010 works perfectly and produces a grid with the correct data displayed.
Unfortunately, the EntityDataSource control does not work with the latest version of Entity Framework, EF6. Hopefully the control gets an update in a future update version of VS or EF, but for now you can't use the two together.
There are a few solutions / alternatives:
Drop back to EF 5. In order to do this, delete the .edmx and .tt files from the App_Code folder, delete the EF assemblies from the Bin folder, and remove the references to EF from web.config. Then rebuild the site, add a new ADO.NET Entity Model and choose version 5 in the Choose Your Version dialog. Then delete the .tt files from the App_Code folder, open the EDMX diagam, right-click an empty spot and on the Properties Grid set Code Generation Strategy to Legacy ObjectContext. Then rebuild again, and it should work.
Use Model Binding. This is really the recommended solution. The Microsoft / EF team recommends people to stay away from the EntityDataSource control and only use it for Dynamic Data web sites, Model Binding is the preferred solultion. It's pretty clean and straight forward to use, and gives you a lot of control over your queries and object updates. For more info about Model Binding, check out: http://www.asp.net/web-forms/tutorials/data-access/model-binding/retrieving-data

Inconsistent ADO.NET model after editing database

I am working on a ASP.NET MVC 4 app. I am using Entity Framework Database First design principle.
Initially I created the database on MySQL and then in visual studio i setup a connection to MySQL and generated the ADO.NET data model.
But later I added some tables in MySQL and then from Visual Studio I did this.
I can see the new entity types in the model diagram but no classes corresponding to the new entities have been generated in the Model.tt file. I mean classes from older tables are present, classes from newer tables are missing.
Please help!
Is your edmx nested in a folder? If so this might be a bug that was fixed in VS 2012 Update1 where code would not be re-generated if edmx was in a folder. Install VS 2012 Update 1 and the issue should be gone. You can also right click the edmx file and click Run Custom Tool option to enforce code generation.

How do I upgrade an existing EDMX 1.0 model to the new EDMX 2.0?

I'd like to upgrade an existing EDMX model without having to regenerate it by hand. The database is old, contains virtually no foreign keys and has many tables that had to be merged into single entities. I would like to use the EDMX 2.0 that comes with Visual Studio 2010, but I do not want to recreate the model by hand as that would put us way behind schedule.
Any suggestions?
Open your old project in VS 2010. Then just change Target Framework from 3.5 to 4.0 in your project settings. In this case the .edmx file will be updated automatically.