entity-framework

Faking foreign key updates using entity keys.

In Alex James' Entity Framework tips articles, (which are excellent by the way) he talks about how to fake foreign key properties. This seems like exactly what I need, but for whatever reason I can't seem to pull it off when I'm updating. I have the following in update portion of my controller: [AcceptVerbs(HttpVerbs.Post)] public A...

Async Programming with Entity Framework

Hi, I'm developing a WPF application that talks to a database through the Entity Framework, and I'm having huge issues trying to keep the application responsive. The DataContext isn't thread safe, so you can't do data access from background threads. You can't pass objects between DataContexts due to the object tracking (I've tried for ...

Entity Framework-How To Add To Entites With Navigational Properties

I would like to add a record to a SQL Server table using the Entity Framework. My table's entity has foreign keys and so has navigational properties for those fields. When adding a new record/entity, how do I populate the foreign key fields since they don't appear as properties of the entity? ...

Entity Framework: Customising generated data object exception

Hey all, I am trying to add a property to one of the generated data classes the Entity Framework has created for me. I have done the exact same thing on another generated class without a problem and for some reason it won't work on this one. The only difference between the two generated objects is one is just a straight table mapping ...

Entity Framework and Oracle

I've got to look at the ORM solution for a new ASP.NET Web App with an Oracle backend. Has anyone had good/bad experience with using Entity Framework with Oracle? Are there any (free preferably) alternatives? ...

How to serialize ObjectContext into XML like in DataSets (XML database)?

Hi In datasets there was a method WriteXml or ReadXml Does anyone have any idea on how to this with Entity Framework? Has anyone implemented this before? ...

Silverlight 3 Validation MVVM WCF EF

My application is SL2 reading and writing data through an Entity Framework Model exposed via WCF. We have resisted writing any UI validation due to the exicting new validation controls coming from SL3. ...However after doing a trial update on our project yesterday, we realised that most of the standard practices for attaching validation...

Best practice: multiple entities to single entity

This is a very hard to explain question and I hope my code extract explains most of it. Let's say you have the following database design: And you want to build one generic interface to modify the musicstyle relations between all three entities. Currently I have created a MusicStyleController which requires the type of Entity it is rel...

Entity Framework Query Xml

How would you build up this query with Entity Framework : SELECT * FROM TreeNodes WHERE data.value('(/edumatic/assessmentItem/@type)[1]', 'nvarchar(max)') like 'multiplechoice1' data column is XML. Apparently this is converted to a string by the Entity Framework... This is my start but from here I wouldn't know how to add the w...

Visual Studio 2008 SP1 Closes when I try to add or open a project which contains .edmx files

I have a problem adding ADO.Net Entity Data Model to my existing project, or even while opening a project which contains *.edmx files.(In my case ) Visual Studio closes automatically. I see the following error in the event log every time this happens Googled the specific error but drew a blank. .NET Runtime version 2.0.50727.4016 - Fata...

Removing an association from an entity

Hi, I have 2 entities: User and Company, with a FK from the User to the Company. I'm trying to remove the association and leave the user entity with a scalar property "CompanyId", but still have the "Company" entity in the model (mainly to increase performance, I don't need to full entity attached to it). I'm able to achieve that only ...

Modeling entities for specific applications - Entity Framework

Hi, I have 2 applications: Manager UI - Which should be able to create a user with all its fields (username, email, age etc.) and display them. Core component - which only need the UserId and Username field, and need to be very performant. It also shouldn't be able to write to the database. It seems I need 2 different models, one for...

ADO.NET Entity Connection String for Multiple Projects

I am using multiple layer project where the DataModel hosts the ADo.NET Entity model and DataAccess layer does the validation. However everytime I get a error like this The specified named connection is either not found in the configuration, not intended to be used with the EntityClient provider, or not valid. I have tried connec...

Best practice creating LINQ-to-SQL classes to deal with the same entity present in 10 different data sources?

I was wondering what would be the best way to create LINQ-to-SQL classes to deal with a given entity which is present in 10 different data sources. Let's say I've got the same database in 10 different countries, each of them with a Customers table, and my goal is to access all of them programatically. Should I either create: a single A...

How to have a form data-bound to an object with losing its values on postback

Hi I use ADO.NET Entity-Framework, I have a page that is data-bound to an entity variable in the code file. The hierarchy of the item is Person.Orders I want the user to add/remove orders to this Person entity (Person.Orders.Add(order)), The problem is that while the entity is not saved yet, once the user makes a post back, the variabl...

When to use "LINQ to SQL",entity framework, or NHibernate?

With .NET, which data access method is better to use "LINQ to SQL",entity framework, or NHibernate? Should a different method be used depending on the situation or is it more of a personal preference? If so which method and when? ...

What problem is Microsoft trying to solve with all of these data access strategies?

There seems to be many different data access strategies coming out of Microsoft. There’s ‘classic’ ADO.NET, Linq2Sql, ADO.NET Entity Framework, ADO.NET Data Services, ADO.NET Dynamic Data. I’m sure that I’ve missed some. To me, it seems that there’s a lot of confusion surrounding where each frameworks fit into an application's architectu...

Add a DbProviderFactory without an App.Config

I am using DbProviderFactories in my data layer (based on Entity Framework) and am using SQLite for my database, but I don't have to have a App.Config to have the following code: <configuration> <system.data> <DbProviderFactories> <remove invariant="System.Data.SQLite"/> <add name="SQLite Data Provider" invariant="Syst...

Entity Framework: Find EntityKey Values for One-to-Many

In EF, it is possible to write the following line: orderLine.OrderReference.EntityKey.EntityKeyValues[0].Value Wich results in the ID of the associated OrderReference. What would be the solution if I wanted to know the ID's of the orderLines associated with an order? ...

Is there an option to make Entity Framework revert empty strings to null?

Hi I am using an ADO.NET Entity-Framework ObjectContext to access my data store. I want the if values are set with empty strings, they should automatically become null. ...