edmx

Entity Framework Migrations Error - Sequence contains no elements

ⅰ亾dé卋堺 提交于 2019-12-03 09:30:49
command: add-migration blahblah -verbose error: Sequence contains no elements I did a few things before getting this error. I made a change to my code-first model but did not run add-migration yet. Then I added an EDMX model to play around with an idea visually. I realized the EDMX model was messing with my code so I removed it. I tried to run add-migration and got "Sequence contains no elements". I upgraded to EF 5 and uninstalled the old Migrations package except for my configurations. Then I tried add-migration again and I am still getting "Sequence contains no elements". Below is the rest

Entity Framework edmx click on diagram very slow

…衆ロ難τιáo~ 提交于 2019-12-03 05:46:21
问题 Background first: I have a database-first EF6 model in Visual Studio 2015 (latest nuget 6.1.3 pointing to a local SQL Server 2014 SP1 Express database) on a Windows 10 Pro laptop. After I upgraded from Windows 8.1 and Visual Studio 2013. I also upgraded the model from EF5 about 6 months ago as well, but I don't think this is relevant, as I've also tried rebuilding from scratch. The model: set of about 100 tables, 50 views and 250 associations. The problem is every time I want to make changes

How to join two table from two different edmx using linq query

ⅰ亾dé卋堺 提交于 2019-12-03 03:57:15
How to join two table from two different edmx using linq query.. Is there a way to query from 2 different edmx at a time. Thanks. Update As per your comment, EF wasn't able to parse a combined Expression tree across 2 different contexts. If the total number of records in the tables is relatively small, or if you can reduce the number of records in the join to a small number of rows (say < 100 each), then you can materialize the data (e.g. .ToList() / .ToArray() / .AsEnumerable() ) from both tables and use the Linq join as per below. e.g. where yesterday is a DateTime selecting just a small set

How to get the maximum length of a string from an EDMX model in code?

て烟熏妆下的殇ゞ 提交于 2019-12-03 03:35:36
I've created an EDMX object from a database I'm programming against. I need to get input from a user and save it to a row in the database table. The problem is that I need to limit the length of input strings to the width of the corresponding VARCHAR column in the database. When I browse the model, I can clearly see in the properties window that the model knows the max length of the string, but I don't know how to access this data in code. If I want to write something like this: Entities entities = new Entities(); myTable = entities.myTable.First(); if (userInput.length > myTable.columnA

Entity Framework edmx click on diagram very slow

こ雲淡風輕ζ 提交于 2019-12-02 18:13:50
Background first: I have a database-first EF6 model in Visual Studio 2015 (latest nuget 6.1.3 pointing to a local SQL Server 2014 SP1 Express database) on a Windows 10 Pro laptop. After I upgraded from Windows 8.1 and Visual Studio 2013. I also upgraded the model from EF5 about 6 months ago as well, but I don't think this is relevant, as I've also tried rebuilding from scratch. The model: set of about 100 tables, 50 views and 250 associations. The problem is every time I want to make changes to my model, any kind of click (left or right) on the .edmx diagram causes Visual Studio to become

The diagram for the many to many relationship table does not appear in the edmx

早过忘川 提交于 2019-12-02 13:09:08
I am using a databse first method. I generated edmx from the database. But diagrams for the tables which are in many to many relationships do not display in the generated edmx. If your Many to many lookup table consists of just Foreign Keys and no other fields, then it will not show up in your edmx file as a Table. It will show up under Navigation Properties of each table though. 来源: https://stackoverflow.com/questions/7544259/the-diagram-for-the-many-to-many-relationship-table-does-not-appear-in-the-edmx

What is the best way to re-name a column in edmx?

偶尔善良 提交于 2019-12-02 01:34:32
问题 I am using entity framework 4.0 my approach is Database first approach. what is the best way to rename a column name or change the data type of column in edmx. thanks in advance. 回答1: To rename a column: Rename the column in SQL Management Studio. In the EDMX editor, choose "Update from Database", and complete the wizard. You will get a new column with the updated name, and an error-message saying that the old column is not mapped. Remove the old column. To change the datatype: Update the

What is the best way to re-name a column in edmx?

旧街凉风 提交于 2019-12-01 22:43:32
I am using entity framework 4.0 my approach is Database first approach. what is the best way to rename a column name or change the data type of column in edmx. thanks in advance. To rename a column: Rename the column in SQL Management Studio. In the EDMX editor, choose "Update from Database", and complete the wizard. You will get a new column with the updated name, and an error-message saying that the old column is not mapped. Remove the old column. To change the datatype: Update the datatype in SQL Management Studio. In the EDMX editor, choose "Update from Database", and complete the wizard.

How do I create an association between these 2 entities without touching the DB?

老子叫甜甜 提交于 2019-12-01 20:45:21
I need to create a "virtual" association between these two entities (1-*) so that I can traverse them using linq , but the problem is I cannot touch the database. I have tried to manually edit the edmx many times without success, getting various mapping errors. EDMX: <?xml version="1.0" encoding="utf-8"?> <edmx:Edmx Version="2.0" xmlns:edmx="http://schemas.microsoft.com/ado/2008/10/edmx"> <!-- EF Runtime content --> <edmx:Runtime> <!-- SSDL content --> <edmx:StorageModels> <Schema Namespace="DataAccess.SD.Store" Alias="Self" Provider="Devart.Data.Oracle" ProviderManifestToken="ORA" xmlns:store

EDMX .NET 4.5 to 4.0?

不想你离开。 提交于 2019-12-01 06:44:49
We're using the Entity Framework and we created our EDMX when our project was set to build .NET 4.5. Now we want to switch to .NET 4.0 but when we do, we get compilation errors for the EDMX file. It states the following error: Error 10027: The XML namespace for the conceptual model's schema element is not supported on this project's target framework version. Is there any solution other than recreating the EDMX file? Assuming you don't use features that shipped with .NET Framework 4.5 (enums, spatial types, stored procs with multiple result sets) you can do the following (be sure to back the