entity-framework

RIA Services not returning Included Type Collection Property

I have a WCF RIA Services app and a model with a UserRole type that contains a collection of UserPermission objects. I use .Include("UserPermission") in the domain service and when I debug it I've verified it definitely contains the UserPermission types before returning. When I debug the Silverlight 3 client it returns the UserRoles bu...

How to apply global filter on Entity Framework?

I have a table in my model named Customers with a field IsActive. Whenever I run a query on Customers, only the active customers should be retrieved. I can include the filter in every query, but that doesn't look very. I would like to be able to override the Customers property at the Object Context lever, but I am not sure if this is pos...

VS2008 EF and non crud SP usage.

Using an edmx version of EF. My returned data is a join between tables that has a COMPOUND filter on the primary table. In essence this query is going to return a SEGMENT of Law codes and descriptions that a user can tie to a Sex Offender report. I have a complex SP because Linq2SQL cannot pass in a between statement, or at least th...

Why doesn't this CompiledQuery give a performance improvement?

I am trying to speed up an often used query. Using a CompiledQuery seemed to be the answer. But when I tried the compiled version, there was no difference in performance between the compiled and non-compiled versions. Can someone please tell me why using Queries.FindTradeByTradeTagCompiled is not faster than using Queries.FindTradeByTr...

How do I achieve a 'select or insert' task using LINQ to EF?

I have an import process with regions, locations, and shifts, where a Shift object has a Location property, and a Location object has a Region property. If a region name does not exist, I create the region, and like wise a location. I thought I could neatly encapsulate the 'Select if exists, or create' logic into helper classes for Reg...

Is there a good comparison of the different Entity Framework 2.0 code generators?

Inspired by this post, I'm wondering if anyone has found a good comparison between the POCO Generator and the 1.0esque Entities/Context. Why should I use one over the other? Or, what criteria should I be evaluating on my project to make my decision? I once thought that POCO's were less work for mvc/wcf/databinding. But it seems a mor...

Why newly created entity object with navigation property is automaticly added to ObjectContext?

I have to entities: Company and Location (one to many). When I create new Location entity object and assign navigation property(Company) with the navigation property of already existing Location object (Location _new = new Location(); _new.Company = _old.Company). It seems that at that point newly created object is added to Object Contex...

EF 4.0 and Visual Studio 2008

Can I use EF4.0 relased with .NET framework 4.0 with VS2008? ...

Implement LINQ to Entities unsupported method

Hi! LINQ to Entities has many LINQ methods marked as "Unsupported" (http://msdn.microsoft.com/en-us/library/bb738550.aspx). Is any way to implement some of these methods by hands? Or I should wait next release of EF? I'm especially needing this method: IQueryable<TResult> Select<TSource, TResult>(this IQueryable<TSource> source, Expr...

ADO.NET Entity Framework: Can I have multiple entity types for the same row.

Hi all, I have a base class Participants inherited by Artist, Author and TextWriter. I have only one table in the data store: Participants { ID, FirstName, LastName, IsArtist, IsAuthor, IsTextWriter, } The idea is to have a class for all the roles that a participant can have. I've managed to create the edmx file...

Update data programmatically using EntityDataSource

Hello guys, I want to update the data using programmatically in code behind using EntityDataSource. I have done the samething using Update method of LINQ Datasource. sample code snippet int id => Convert.ToInt32(e.CommandArgument); ListDictionary keyValues = new ListDictionary(); ListDictionary newValues = new ListDictionary(); ListD...

Entity Framework Multiple associations to a table causes error 3033

I'm using EF 3.5 SP1. I have 3 tables: Pendants PendantAccessories PartsData Basically #1 and 2 are used for product selection, so #1 has a "Number of Buttons" property and other options. #2 has fields like "Cable Type" etc. The third table contains property information for all of our parts, such as what plant it's manufactured...

Select base class in Entity Framework

Suppose I have table Person table Employee, which inherits Person. I want to get a list of Person, regardless if this Person is Employee or not. How do you get entity framework to do that without joining the Employee table? C# is what I'm using. Thanks. ...

Repository Pattern and Entity Framework.

I want to make an implementation with repository pattern with ASP.NET MVC 2 and Entity Framework but I have had some issues in the process. First of all, I have 2 entities that has a relationship between them, like Order and Product. When I generate my dbml file it gaves me a class Order with a property that map a "ProductSet" and one ...

Where is EntityConfiguration in EF4 VS 2010 RTM?

I cannot find EntityConfiguration. The same question for RC was here but I thought that it would make it to the RTM version. Is it there? ...

How to cache L2E entity without attach/detach?

The following code will select a key/value table in the DB and will save the result to the cache: using (var db = new TestEntities()) { if(Cache["locName_" + inventoryLocationName] != null) return Cache["locName_" + inventoryLocationName]; var location = db.InventoryLocationsSet.FirstOrDefault( i => ...

Updating Model with entity collection

There are a group of entities named Book and Magazine which inherits from the abstract class PublishedItem. PublishedItem have these properties: ID, Name, Publisher, List of Authors, List of Genres. The Book entity has the ISBN property and the Magazine entity has the ISSN property. I just want to ask how I can update the book's or maga...

Linq to Entities and POCO foreign key relations mapping (1 to 0..1) problem

For my ASP.NET MVC 2 application I use Entity Framework 1.0 as my data access layer (repository). But I decided I want to return POCO. For the first time I have encountered a problem when I wanted to get a list of Brands with their optional logos. Here's what I did: public IQueryable<Model.Products.Brand> GetAll() { IQueryab...

Generate Enum from Values present in a table using ADO.NET Entity framework

My requirement is to create an Enum based on values present in a table from DB. I am using ADO.NET Entity Framework model (.edmx file), Can any one of you help me out... Thanks, Vinni ...

Repository Pattern with Entity Framework 3.5 and MVVM

I am developing a Database File System. I am using - .Net framework 3.5 Entity Framework 3.5 WPF with MVVM pattern The project spans across multiple assemblies each using same model. One assembly,let's call it a "server", only adds data to the database using EF i.e. same model.Other assemblies (including the UI) both reads and wri...