linq-to-entities

Expression.Invoke in Entity Framework?

The Entity Framework does not support the Expression.Invoke operator (You receive the following exception when trying to use it: "The LINQ expression node type 'Invoke' is not supported in LINQ to Entities.) Has anyone got a workaround for this missing functionality? I would like to use the PredicateBuilder detailed here in an Entity Fr...

Learning about LINQ

Overview One of the things I've asked a lot about on this site is LINQ. The questions I've asked have been wide and varied and often don't have much context behind them. So in an attempt to consolidate the knowledge I've acquired on Linq I'm posting this question with a view to maintaining and updating it with additional information as ...

Linq to Entities vs ESQL

When using the Entity Framework, does ESQL perform better than Linq to Entities? I'd prefer to use Linq to Entities (mainly because of the strong-type checking), but some of my other team members are citing performance as a reason to use ESQL. I would like to get a full idea of the pro's/con's of using either method. ...

How to implement Repository pattern withe LinqToEntities?

How to implement Repository pattern withe LinqToEntities how to implement the interface ...

Why all the Linq To Entities Hate?

I've noticed that there seems to be quite a bit of hostility towards Linq To Entities particularly from the Alt.Net folks. I understand the resistance to more "drag and drop" programming, but from my understanding, Linq To Entities doesn't require it. We're currently using Linq to SQL, and we are using the DBML document to define it ...

How to Implement Database Independence with Entity Framework

I have used the Entity Framework to start a fairly simple sample project. In the project, I have created a new Entity Data Model from a SQL Server 2000 database. I am able to query the data using LINQ to Entities and display values on the screen. I have an Oracle database with an extremely similar schema (I am trying to be exact but I d...

Linq to Entity with multiple left outer joins

Hi, I am trying to understand left outer joins in LINQ to Entity. For example I have the following 3 tables: Company, CompanyProduct, Product The CompanyProduct is linked to its two parent tables, Company and Product. I want to return all of the Company records and the associated CompanyProduct whether the CompanyProduct exists or no...

How to do a "where in values" in LINQ-to-Entities

Does anybody know how to apply a "where in values" type condition using LINQ-to-Entities? I've tried the following but it doesn't work: var values = new[] { "String1", "String2" }; // some string values var foo = model.entitySet.Where(e => values.Contains(e.Name)); I believe this works in LINQ-to-SQL though? Any thoughts? ...

SQL tracing LINQ to Entities

So, I would like to know oh to do a "full" tracing of Linq to Entities? In other words: I already know about the ToTraceString() method, but this only works on an ObjectQuery. I need it to work on on the entire Linq layer... so when I am doing IQueryable "Where" expressions and additional filtering that I can see the entire query, not ...

Is there a DataContext in LINQ-to-Entities (NOT Linq-to-SQL)?

Hello, I recently asked a question about tracing Linq-to-Entities I think that one of the answers was not right, as they refer to using the DataContext. Is there a DataContext for LINQ-to-Entities? If so, how do I get it? ...

Has anyone used lucene.net with Linq-to-Entities?

If anyone has done this, please let me know. I don't know anything about lucene.net. I have never used it, but I heard about it. I was wondering how something like that would integrate with the Linq entity framework? ...

Using Linq with WCF

I am looking for any examples or guides to using Linq over WCF (n-tier application). Please specify if you are showing something for Linq-to-SQL or Linq-to-entities. I would like to see usage examples for both. I am wondering how things like deffered execution works over WCF (if it works at all)? Cyclic references support and so on... ...

Best Practices for Entity Framework and ASP.NET

I've been driving myself crazy trying to get the Entity Framework to work as expected (or at least as I expect) in an ASP.NET environment, specifically dealing with objects belonging to different contexts when attempting to save to the database. What are the best practices when dealing with the Entity Framework and ASP.NET? ...

Entity framework and queries' SQL logging

I'm using LINQ to Entities. I need to log the resulting SQL of every executed query. It'd be nice to log the execution times and the number of rows returned, though it's not crucial. Is there a way to do this from within the app? I'd rather not use the SQL Profiler. There should be a way to trace everything that goes from the framework...

Persistence framework?

I'm trying to decide on the best strategy for accessing the database. I understand that this is a generic question and there's no a single good answer, but I will provide some guidelines on what I'm looking for. The last year we have been using our own persistence framework, that although limited has server as well. However it needs some...

Filter EntityDataSource on Association value

I really like Entity Framework, but there are some key pieces that are a challenge to me. Can anyone tell me how to filter an EntityDataSource on an Association column? EF hides the FK values and instead has an Association property. Given an Entity, Person, with a PersonType association, I would have expected something like this to work ...

Linq to Entities with WCF

Hi there, I have all my entities in a seperate project in my edmx file and I expose them to my client application using a WCF service. That means I don't have to give my client app a direct link to the project that contains the edmx file. That would be bad because it contines the object to query the database with. But only the entitie...

How to check for the presence of an OrderBy in a ObjectQuery<T> expression tree

I'm using t4 for generating repositories for LINQ to Entities entities. The repository contains (amongst other things) a List method suitable for paging. The documentation for Supported and Unsupported Methods does not mention it, but you can't "call" Skip on a unordered IQueryable. It will raise the following exception: System.Not...

How do I use LINQ to Entities in Visual Basic?

I've created a .NET solution with two projects: ToyData (Visual Basic Class Library) ToyOne (Visual Basic WPF Application) The ToyData project contains Toy.edmx, an ADO.NET Entity Data Model generated from a database called Toy. The ToyOne project contains this Window1.xaml.vb file: 1 Imports ToyData 2 3 Class Window1 4 ...

How do I extend ADO.NET Entity Framework objects with partial classes?

I've created a Visual Basic WPF Application project that contains Toy.edmx, an ADO.NET Entity Data Model generated from a database called Toy. Its Window1.xaml.vb file looks like this: 1 Class Window1 2 3 Private Sub Window1_Loaded( _ 4 ByVal sender As System.Object, _ 5 ByVal e As System.Windows.RoutedEventArgs...