linq-to-entities

what is a performance way to 'tree-walking' through my Entity Framework data

Hi, I have a Entity Framework design with a few tables that define a "graph". So there can be a large chain of relationships between objects in the few tables via concept of parent/child relationships. What is a performance way to 'tree-walking' through my Entity Framework data? That is I assume I wouldn't want to load the full set o...

linq select m:n user:groups

Hi guys, I've got three tables: cp_user (id, name) cp_group (id, name) cp_usergroup (user_id, group_id) the classical m:n stuff. Assume the following Data: cp_user 1, Paul 2, Steven cp_group 1, Admin 2, Editor cp_usergroup 1, 1 1, 2 2, 2 So Paul is in the Admin AND Editor group, while Steven is just in the Editor group. I wan...

how can I code a recursive query in an Entity Framework model?

Hi, I have a model which includes NODES, and RELATIONSHIPS (that tie the nodes together, via a parent_node, child_node arrangement). Q1 - Is there any way in EF / Linq-to-entities to perform a query on nodes (e.g. context.Nodes..) to find say "all parents" or "or children" in the graph? Q2 - If there's not in Linq-to-entities, is th...

C# PredicateBuilder Entities: The parameter 'f' was not bound in the specified LINQ to Entities query expression.

I needed to build a dynamic filter and I wanted to keep using entities. Because of this reason I wanted to use the PredicateBuilder from albahari. I created the following code: var invoerDatums = PredicateBuilder.True<OnderzoeksVragen>(); var inner = PredicateBuilder.False<OnderzoeksVragen>(); foreach (var filter in set.RapportInvoerF...

'Random' Orderby in webservice using LINQ To Entities

Morning all Now I know there is a reason to this odering but my tiny little brain can't get my head around it. I am using a webservice to pull through data to a webp[age and have the following that is so far pulling data through from UUF1: public string[] GetBuyer(string Memberkey) { try { ...

How to optimize this Linq query

I am trying to optimize this query. It is not slow for now but I am expecting a spike to hit this query in the near future. Is there anything else i can do to make this query faster? var posts = from p in context.post where p.post_isdeleted == false && p.post_parentid == null select new ...

Understanding many to many relationships and Entity Framework

I'm trying to understand the Entity Framework, and I have a table "Users" and a table "Pages". These are related in a many-to-many relationship with a junction table "UserPages". First of all I'd like to know if I'm designing this relationship correctly using many-to-many: One user can visit multiple pages, and each page can be visited b...

How can I implement String.Concat(object, object) to L2E framework?

I have two long type columns that I want to concat during sql query. Using Linq to Entities making it impossible, because it only supports String.Concat(string, string). I'd like to know how can I implement this function myself and add it to the L2E framework. ...

Stored Functions with Linq to Entities

Hi, How can I make a MS-SQL stored function availabe in LINQ expressions if using the Entity framework? The SQL function was created with CREATE FUNCTION MyFunction(@name) ...). I was hoping to access it similarly to this: var data = from c in entities.Users where MyFunction(c.name) = 3; Unfortunately I have only .NET 3.5 available....

Using FTS with complex entity framework objects

Hello, In my system I'm using entity framework. I have the following objects: Person, User, Customer. Customer inherits User which inherits Person. I would like to create a Full Text Search for customers in the system that will query also fields from the People table. I know I can't use Full Text Search directly with LINQ-to-Entities,...

Linq LIKE functionality

so.. I'm using LinqToEntities, and I want to query part of a field. Normally I'd use the LIKE keyword with SQL, and then go from there.. I see that Linq does not have it.. Whats a good way to get the same kind of functionality? ...

EF/LINQ: Where() against a property of a subtype

I have a set of POCOs, all of which implement the following simple interface: interface IIdObject { int Id { get; set; } } A subset of these POCOs implement this additional interface: interface IDeletableObject : IIdObject { bool IsDeleted { get; set; } } I have a repository hierarchy that looks something like this:...

Designer tool for Windows Azure Table Storage

I am using Windows Azure Table Storage. I am wondering, if I could use any designer tool. In principle it is Linq to Entities, I think. Maybe I could use a tool for Linq to Entities? ...

LINQ to SQL or Entities, at this point?

I'm a bit late to the game and have decided to spend some spare time learning LINQ. As an exercise, I'm going to rewrite a WebForms app in MVC 2 (which is also new to me). I managed to find a few topics regarding LINQ here (http://stackoverflow.com/questions/16322/learning-about-linq, http://stackoverflow.com/questions/8050/beginners-gui...

Mocking ObjectContext, dealing with ObjectQuery.Include(string) method?

I have been investigating how to decouple my DomainServices from their datasource so I can test them in unit tests. I'm starting to think fully decoupling them is not possible. There is a decent amount of info out there, such as this question and this blog post. The blog post in particular gets you really far into mocking ObjectContext....

How to turn this LINQ query to lazy loading

I would like to make a certain select item to lazy load latter in my linq query. Here is my query var posts = from p in context.post where p.post_isdeleted == false && p.post_parentid == null select new { p.post_date, p.post_id, p.post_titleslug, ...

What is the return type for a anonymous linq query select? What is the best way to send this data back?

This is a basic question. I have the basic SL4/RIA project set up and I want to create a new method in the domain service and return some data from it. I am unsure the proper easiest way to do this.. Should I wrap it up in a ToList()? I am unclear how to handle this anonymous type that was create.. what is the easiest way to return this ...

How to limit select items with L2E/S?

This code is a no-go var errors = (from error in db.ELMAH_Error select new { error.Application, error.Host, error.Type, error.Source, error.Message, error.User, error.StatusCode, error.TimeUtc }).ToList(); ...

How do I get a right outer join in L2E?

I have two tables that I set up through the VS Entity Data Model Diagram tool. I'm trying to do a right outer join and it doesn't return results from the 2nd table. I have set up a 0..1 to MANY relationship from the diagram tool. When I run a Linq-To-Entities query, it still defaults to an INNER JOIN. From my understanding of entitie...

what possible workarounds are there for "only parameterless constructors are support in Linq to Entites"

In my query I need to return instances of a class that doesn't have a default constructor (specifically this is in a custom Membership provider, and MembershipUser is the culprit) var users = from l in context.Logins select new MembershipUser( Name, l.Username, // username l.Id, // provider key l.Mail...