edmx

Can Entity Framework 4.1 designer “update model from database” for selected entities only?

一笑奈何 提交于 2019-12-10 04:19:26
问题 The situation: Sometimes a database schema is not what you would consider an ideal representation of the system's information and you may not be able to change it. We have been using Entity Framework to create a nicer conceptual model to code against in situations like this. This means updating the model from the database and then changing it ourselves, either through the designer or through the .edmx file directly using a text editor. The problem: When you update the model from the database,

The complex type 'MyData.AssetReading' refers to the entity type 'MyData.Asset' through the property 'Asset'

自闭症网瘾萝莉.ら 提交于 2019-12-10 00:10:47
问题 Looking at setting up Web API odata and trying to expose the data out of our edmx to it. The problem is that every time i add an entity to the OdataConventionBuilder I get a big nasty error message on load saying: The complex type 'MyData.AssetReading' refers to the entity type 'MyData.Asset' through the property 'Asset' It seems for relations defined in the edmx is bombing the webapi odata out about a complex type. Any ideas on how to get around this as the edmx is huge and a rejig of it is

Entity Framework Migrations Error - Sequence contains no elements

牧云@^-^@ 提交于 2019-12-09 07:39:56
问题 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

How to add an EF6 Association to a Candidate Key / Unique Key which is not the Primary Key?

被刻印的时光 ゝ 提交于 2019-12-09 02:36:15
问题 Using Schema First , I have a database structure, as so ExternalDataItems --- edataitem_id PK -- surrogate auto-increment - NOT for FK relation here datahash UX -- Candidate Key / Unique Index (binary(20)) ExternalMaps --- emap_id PK ext_datahash FK on ExternalDataItems.datahash - NOT referencing the surrogate PK and after generating the SSDL/CSDL 1 has this <Association Name="FK_ExtMaps_ExtDataItems"> <End Multiplicity="1" Role="ExternalDataItems" Type="Store.ExternalDataItems" /> <End

How to properly delete and re-add Entity Data Model

狂风中的少年 提交于 2019-12-08 15:49:53
问题 newbie to Entity Framework here. Using VS 2010 and SQL Server 2008 express DB. I was having trouble refreshing an Entity Data Model after adding new tables. So, I followed a suggestion I found here to just delete and regenerate the model. I get to the "Choose Your Data Connection" section of the Entity Data Model Wizard and "Save entity connection settings in Web.config as:" is checked. However, my existing name has a 1 appended to it. For example MyDatabaseEntities is now MyDatabaseEntities1

unify two models (edmx) with visual studio 2010

孤人 提交于 2019-12-08 11:14:32
Hello as actually as i know you can not make relations between tow models or have in one models entities from two databases, it's a posibility two join two models both of them with existig databases behind? or there is some experience with a method like: move entities from the designer of one of them to the other and some bcp (SQL server) magic to move data and recreation on only one database? Thanks. As I know the answer is: No you can't join models targeting different databases and you can't place entities from multiple databases in single model. However you should be able to make relations

unify two models (edmx) with visual studio 2010

左心房为你撑大大i 提交于 2019-12-08 04:34:25
问题 Hello as actually as i know you can not make relations between tow models or have in one models entities from two databases, it's a posibility two join two models both of them with existig databases behind? or there is some experience with a method like: move entities from the designer of one of them to the other and some bcp (SQL server) magic to move data and recreation on only one database? Thanks. 回答1: As I know the answer is: No you can't join models targeting different databases and you

Entity Framework with MYSql, return no column in complex entity return type

折月煮酒 提交于 2019-12-07 08:45:54
问题 I'm using MySQL in combination with an edmx file. I'm facing a problem when adding a function to stored procedure. When I select "complex type" and press the "get column information" button I receive the following message: "The selected stored procedure returns no columns." When I create the same procedure in SQL Server and then added the function to a new edmx file, its creating the complex type perfectly. Thanks, Nauman 来源: https://stackoverflow.com/questions/9940749/entity-framework-with

POCO Class in EF not working as Expected

≡放荡痞女 提交于 2019-12-07 03:37:28
问题 I have created a DataBase in SQL and created an EDMX in Visual Studio 2012. It automatically created POCO (TT) classes. Everything looks fine. Now I change the column name of a table. I update the EDMX. Opening the EDMX in XML and everything looks fine. Question 1 After I ran Custom tool in TT, I see that a new property got created additionally, e.g.: SQL table name : Student Column name : sName In my POCO Class public int sName{ get; set; } got automatically created. Now I change the column

EF6 code first: How to load DbCompiledModel from EDMX file on startup?

瘦欲@ 提交于 2019-12-06 22:49:50
问题 I want to reduce startup time in EF6 by caching the DbCompiledModel to disk. It's easy to write the EDMX file for a DbContext: EdmxWriter.WriteEdmx(myDbContext, XmlWriter.Create(@"C:\temp\blah.xml")) And it's easy to pass a DbCompiledModel to the DbContext: var db = new DbContext(connectionString, myDbCompiledModel) However there doesn't seem to be any way to read the EDMX file from disk into a DbCompiledModel! How can I do this? NOTE that I have successfully implemented the solution using