linq-to-entities

How do you do Multiple Inner Joins in Linq to Entities

I have already searched through SO and could not fins a workable solution for this. I am just trying to figure what is the syntax for multiple inner joins in Linq to Entities. Thanks ...

Linq If Statement

How would i write something like this in linq to entities sb.Append(" WHERE question.question_isdeleted = 0"); if (catid != 0) sb.AppendFormat(" AND (CatID IN ({0}))", catsSTR); if(!string.IsNullOrEmpty(AuthorID)) sb.Append(" AND (question_ownerid = @id)"); i think I just need the syntax to write an if conditio...

How do I find out What Query was sent to SQL Server using Linq To Entities

I want to find out what query string was sent to sql server from using Linq to Entities. ...

What is the difference between LINQ to Entities and the Entity Framework?

Simple question: What is the difference between LINQ to Entities and the Entity Framework? Up till now I thought that both were different names to describe the same thing, but I'm starting to get the feeling that it's not ...

I need to confirm this about linq to sql/entity

if you have something like(just an example don't worry) var result = from n in mytable select n; var last = n.LastOrDefault; var secondresult = n.FirstOrDefault; var Thirdresult = secondresult.FirstOrDefault; var Finalresult = Thirdresult.FirstOrDefault; is this will query the database 5 times? ...

Has Microsoft Fixed Linq to Entities Performance Problems in .NET 4.0?

I feel pretty comfortable with the entity framework now. I have been reading some performance articles on the Linq to Entities performance issues. Are these issues still present in .NET 4.0? ...

Linq to Entities and SQL Server 2008 hierarchy id

Does Visual Studio 2008 SP1 / .NET 3.5 support Linq to Entities (ADO.NET Entity Data Model / edmx) with SQL Server 2008 R2? Specifically, the hierarchy id type? If so, do you have a download link, if not is there a published date when this feature will become available? I experimented a bit today after installing GDR R2 to support Sql...

How to compare only date components from DateTime in C#?

I am having two date values, one already stored in the database and the other selected by the user using DatePicker. The use case is to search for a particular date from the database. The value previously entered in the database always has time component of 12:00:00, where as the date entered from picker has different time component. ...

Does Linq to Entities 4.0 have Fulltext capabilities?

Just wanted to know if Linq to entities 4.0 have fulltext search capabilities? Thanks ...

Linq to Entities - Delete from a link / junction table

I'm building an ecommerce site with products being in multiple categories. As a result of this I've got a Products table, a Categories table and a ProdCat linking / junction table that contains all the productId / CategoryId combinations. When performing an update using Linq To Entities (which I'm using today for the first time) I'm at ...

Linq to EF Expression Tree / Predicate int.Parse workaround

Hi All, I have a linq Entity called Enquiry, which has a property: string DateSubmitted. I'm writing an app where I need to return IQueryable for Enquiry that have a DateSubmitted within a particular date range. Ideally I'd like to write something like IQueryable<Enquiry> query = Context.EnquirySet.AsQueryable<Enquiry>(); int dateSt...

Linq to entities Left Join

Hi all, I want to achieve the following in Linq to Entities: Get all Enquires that have no Application or the Application has a status != 4 (Completed) select e.* from Enquiry enq left outer join Application app on enq.enquiryid = app.enquiryid where app.Status <> 4 or app.enquiryid is null Has anyone done this before without using...

EntitySQL -- Object reference not set to an instance of an object

I am getting this error when I try to do an insert on a column that is a foreign key. Here is how I am assigning the value var at = MvcApplication1.Entity.alttitles.Createalttitles(0, altTitleText); at.question.question_id = questionid; //Error here at.userinfo.user_userid = _AuthorID; //Error here context.A...

Why Does the Entity Framework make so Many Roundtrips to the Database?

Hello, I am rewriting my application to use the entity framework. What I am confused about is the code I am writing looks like it is making unnecessary tripts the the sql server. For example, I have a question answer site similar to SO. When I add an answer to a question -- here is the code I use: var qu = context.question.where(c => c....

What Book did you Read to Learn the Entity Framework?

I am having a little trouble understanding how entity framework works. I am reading "Entity Framework" by Oreilly for the second time. I am not sure if its me or the book that is the problem. But I have never had a problem reading any programming book probably with the exception of XSLT 2.0. Do you guys have any books or resources that i...

Is it a bad idea to jump into LINQ to SQL now?

I have been using ADO.NET in favor of LINQ to SQL (or Entities) up to this point. I'm starting a new project that should be smallish, at least at first but I would like to have room to expand down the line. I feel now is a good time to get into LINQ. I've avoided it for quite a while; however, I'm concerned by the current direction of...

From old DataLayer to LINQ to SQL / Entity Framework

There are a few "should I chose this or that" questions on SO and Google, as well as a lot comparing LINQ2SQL and LINQ2E. I've seen drawbacks, differences, cons, pros, limitations, etc. I cannot say I'm an expert but I'd like to know "what would you do" if you faced this scenario and why. I have to add stuff to an "old" 2.0 app that ha...

proper way of doing a left join with linq to entity?

since DefaultIfEmpty() is not supported, what is the proper way of doing a left join? ...

Linq to Entities query hitting db twice

Hi, I have the following pretty simple linq query querying a linq to entities edmx. (from i in ent.Inspectors select i).OrderBy(s => s.Surname).Skip((page - 1) * count).Take(count).ToList(); In Sql Server Profiler I can see that the exact same select query is being sent twice. Can someone explain why? Cheers, Dave ...

Iterate through data returned from var to get names and values of columns

I am using Linq to Entities in a method and returning specific columns of data from the method. I don't know what type I'll be returning so I rigged it to return a List. If someone knows a better way than the way I rigged it, PLEASE let me know. See the code below. After returning this data, I then need to iterate through the colum...