entity-framework

WPF designer won't load when binding datasource from entity framework

EDIT: I have submitted a bug report and Microsoft have acknowledge that it is a bug. There is currently no ETA on when it will be fixed. Bug Report: https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=386982 Official Feedback: http://social.msdn.microsoft.com/Forums/en-US/vswpfdesigner/thread/ca3cac55-c1de...

ADO.NET Entity Framework: Decision Making between ORM solutions

I am looking for some guideline for my new application while choosing ORM. I want to evaluate EF over NHibernate and LINQ to SQL. I need some expert voice from this wonderful community. You can evaluate on following point. Scalability Learning curve Easy to use Performance ETC. ...

Entity Framework, Compiled Queries and IIS

I am using Entity Framework with my website. To improve performance, I have started to use compiled queries wherever I can, either directly with CompiledQuery.Compile or using ESQL. The performance now is fantastic, that's it, once the queries are compiled. Compiling them takes quite a bit of time on some pages apparently, so the first...

How do I replace an Int property with an Enum in Entity Framework?

I have an entity class that has a property with an underlying db column of datatype Int, however in reality I want this property to be an Enum. Is there any way to specify that this property returns an Enum? ...

Class and Interface hierarchies in Entity Framework?

I have two related classes which share a common interface and are both stored in the same underlying database table. However, the Entity Framework generates one common class, where I really need the two distinct classes. How do I resolve this? Is it best to use a base class rather than an interface? How do I change the EF model to provid...

Is linq2sql behind the scence equal to Entity Framework

i know its a new thing , more powerful and a lot more options added to it, but is linq2sql is part of the new EF ? if not , what is the main different between the two frameworks? ...

ADO.NET Entity Data Model Allows Circular Foreign Key Refs

I am using the new ADO.NET Entity Data Model on a simple database. I have a table/entity with a primary key (PageID) and a ParentID foreign key that references back to itself on PageID for a parent/child "0..1 to many" relationship. On a ASP.Net page, I'm using a FormView with a asp:DynamicControl to express this as a control. That p...

ADO.NET Entity : getting data from 3 tables

I have following table structure: Table: Plant PlantID: Primary Key PlantName: String Table: Party PartyID: Primary Key PartyName: String PlantID: link to Plant table Table: Customer PartyID: Primary Key, link to Party CustomerCode: String I'd like to have Customer entity object with following fields: PartyID: Primary Key ...

What strategy should I take now that MS will no longer support LINQ to SQL?

Please if you have used NHibernate and Entity Frameworks, please contrast your experiences. ...

Delphi Prism and LINQ to SQL / Entity Framework

I have found many posts and examples of using LINQ-syntax in Delphi Prism (Oxygene), but I have never found anything on LINQ to SQL or Entity Framework. Is it possible to use LINQ to SQL or Entity Framework together with Prism? Where can I found such an example? Update: Olaf is giving an answer through his blog The question is now if...

How to map a related table to an inherited entity (table-per-hierarchy)?

Hi erverybody, i've got this tables in my database. With Entity Framework i would like to have something like that: I've used table-per-hierarchy inheritance, so i added a new entity for the premium user and map it to the user entity with conditions to IsPremiumUser property. I would like to have the PremiumAccount table associate...

How to do this in ADO.NET Entities Framework

I have a table called BlogPost which has a 1-to-many relationship with the Comment table. (In Comment, there's a foreign key BlogPostId.) Now I want to retrieve all posts as well as the latest comments of each post. I've tried with s/t like below but it doesn't work. from r in Db.BlogPost select new {Post = r, LatestComment = r.C...

Linq2Sql Many:Many question, How would you do this?

I know many:many isn't supported in Linq2Sql but I am working on a workaround I am working with my little SO clone and I have a table with Questions and a table with Tags and a linking table QuestionTag so I have a classic many:many relationship between Questions and Tags. To display the list of Questions on the front page I have this...

DB Design: more tables vs less tables

Say I want to design a database for a community site with blogs, photos, forums etc., one way to do this is to single out the concept of a "post", as a blog entry, a blog comment, a photo, a photo comment, a forum post all can be thought as a post. So, I could potentially have one table named Post [PostID, PostType, Title, Body .... ], ...

Manage ADO.NET Entity Framework ObjectContext in ASP.NET MVC

I'm using ADO.NET EF in an MVC application. I'm considering putting the ObjectContext inside HttpContext.Current so that all logic in the same request can access to it without having to open/destroy each time. However, I'm really sure if it's a good way to manage ObjectContext instances. I have 2 questions regarding this need: As Ht...

Entity framework function import, can't load relations for functions that return entity types

I've created a function import that returns the results of a stored proceedure as one of my entities. however I can't seem to traverse my through navigation properties to access the data in other entities. I know that you can use include() for objectQueries but can't find anything that will force the EF to load my relations for entity re...

How do you specify a where clause on data returned from a .Include in an Entity Framework query?

Given the following database table hierarchy: Region ------ RegionId RegionName Country ------- CountryId RegionId CountryName Destination ----------- DestinationId CountryId DestinationName Venue ----- VenueId DestinationId VenueName I have the following Entity Framework query: var result = from region in context.Region.Include("...

Batch insert/update with entity framework

I have a Tags table whose schema consists of only ID and Name (unique). Now, from the GUI user can enter tags for a BlogPost. When the data is saved, with tags stored in an array of string (names), I want to add tags whose names don't yet exist to the Tag table and ignore tags whose names already exist AND get back the list of all tag...

'Contains()' workaround using Linq to Entities?

I'm trying to create a query which uses a list of ids in the where clause, using the Silverlight ADO.Net Data Services client api (and therefore Linq To Entities). Does anyone know of a workaround to Contains not being supported? I want to do something like this: List<long?> txnIds = new List<long?>(); // Fill list var q = from t in ...

How do I implement a many-to-many association from an entity to itself in Entity Framework?

I have an entity that exposes a collection of children of the same type. The entity can itself be a child of another instance - in effect a many-to-many relationship with itself. In the database I have a linker table with two columns - parentId and childId - both of which reference the Id column in my entity table. Entity Framework corre...