Language Integrated Query (LINQ) is a Microsoft .NET Framework component that adds native data querying capabilities to .NET languages.

learn more… | top users | synonyms

0
votes
0answers
6 views

Should the MongoDb Official driver translate a Distinct() linq operator into a database operation?

I'm using the MongoDb official driver and issuing a Distinct() operation (which is a supported Linq operation), exactly as per the example. What I would expect to see in the MongoDb output is some ...
1
vote
3answers
43 views

sub linq query is making this take a very long time, how can I make this faster?

I have a list of employees that I build like this: var employees = db.employees.Where(e => e.isActive == true).ToList(); var latestSales = from es in db.employee_sales.where(x => x.returned == ...
-1
votes
3answers
50 views

Converting a For Loops to Linq

The below code is working as expected but I'm wondering is there a way to improve my code using Linq? what I am doing is finding to see if the rows[5] and rows[6] has value. for (int i = 0; i < ...
1
vote
1answer
48 views

How to get the re-occurrence count of an item in an IList? (Without Immutable in loop)

Hey guys I feel like this is a pretty simple question but I cannot find the answer. I have an IList with a bunch of items in it. And I want to count how many items are duplicated(This IList will have ...
0
votes
3answers
49 views

LINQ - “Unable to create constant value of type [type]”?

Here's my error Unable to create a constant value of type 'Courses.Model.Track'. Only primitive types or enumeration types are supported in this context. and here's the code that causes it: ...
0
votes
1answer
24 views

Given a DateTime, how to Call .ToUniversalTime when using LINQ to NHibernate?

I have a method which returns all the events based on an EventTypeID: public IList<Event> FindAll(int eventTypeId, DateTime? modifiedSince) { IQueryable<Event> query ...
3
votes
1answer
31 views

calculate the total time grouping by date and id using linq

My data looks like this ID | START_DATE | END_DATE | Chapter 1 01/03/2013 05:15:14 01/03/2013 06:20:14 1 1 01/03/2013 06:25:33 01/03/2013 ...
0
votes
2answers
35 views

Use Linq to return first result for each category

I have a class (ApplicationHistory) with 3 properties: ApplicantId, ProviderId, ApplicationDate I return the data from the database into a list, however this contains duplicate ...
0
votes
1answer
18 views

Nhibernate Fetch/FetchMany/ThenFetch duplicate results

I'm quering my database. The structure looks like below Country 1..M CountryLocales 1 .. M Cities 1..M CityLocales So, each Country has multiple locales, each City has multiple locales and a ...
0
votes
1answer
43 views

Outputting linq getting overflow exception

I'm trying to output a certain answer with matching data using linq. Here's the code, public string[] netoilVar(string[] final) { var items = netOil.Zip(seqNum, (oil, seq) => new ...
-2
votes
3answers
43 views

How can I parse an XML element to XElement

I have a problem that I still can not solve. I have text that comes from a TextBox and it is something like that: <assemblyIdentity name="MyAssemblyName" publicKeyToken="my1231key" /> I want ...
2
votes
1answer
41 views

Linq and object's wrapper

I have a class MyObj that had a Width property. I need to remove that property from MyObj to MyObjWrapper that will wrap MyObj. I use it like this: Dim _MyObjWrapper As MyObjWrapper = New ...
0
votes
2answers
59 views

How to transform sql query to linq query

delete from detail where autoid not in (select min(autoid) from detail where CATEGORY<>'Accepted' group by ATM_Id, Date, Card ,Transit ,Ck) and CATEGORY<>'Accepted' what I was tried ...
8
votes
1answer
75 views

Internal System.Linq.Set<T> vs public System.Collections.Generic.HashSet<T>

Check out this piece of code from Linq.Enumerable class: static IEnumerable<TSource> DistinctIterator<TSource>(IEnumerable<TSource> source, IEqualityComparer<TSource> ...
0
votes
5answers
57 views

Linq get data as quaternary packs

I like to select all data as unpredictable number of quaternary packages (packs which each contains four item) something like the fallowing: foreach(var quaternary in ...

1 2 3 4 5 2001
15 30 50 per page