Questions tagged [linq]
Language Integrated Query (LINQ) is a Microsoft .NET Framework component that adds native data querying capabilities to .NET languages, although ports exist for Java, PHP, JavaScript and ActionScript.
89
questions
1
vote
2
answers
1k
views
Style for creating IEnumerable unions [closed]
There isn't any cool LINQ sugar for creating unions. The Enumerable.Union() method is usually called like this:
var bigList = list1.Union(list2);
The alternative is to call Enumerable.Union() which ...
12
votes
3
answers
2k
views
What problem domain is LINQ made for?
Each time I see a question posted on Stack Overflow on C#, I see at least one or two answers posted that solve a problem with LINQ. Usually people with very high reputation seem to use LINQ like pros.
...
5
votes
2
answers
12k
views
Is it better to create a stored procedure or entities to get to the data I need?
I just jumped into a new project with a new company using Entity Framework and ASP.NET MVC 4. I am no expert on Entity Framework, but I think I have a decent grasp of how to use it.
From what I can ...
94
votes
5
answers
128k
views
for vs. foreach vs. LINQ
When I write code in Visual Studio, ReSharper (God bless it!) often suggests me to change my old-school for loop in the more compact foreach form.
And often, when I accept this change, ReSharper goes ...
3
votes
1
answer
1k
views
Algorithm to optimize grouping
I would like to know if there's a known algorithm or best practice way to do the following:
I have a collection with a subcollection, for example:
R1 R2 R3
-- -- --
M M M
N N
L L
A
What i ...
3
votes
5
answers
766
views
Using 'new' in a projection?
I wish to project a collection from one type (Something) to another type (SomethingElse). Yes, this is a very open-eneded question, but which of the two options below do you prefer?
Creating a new ...
2
votes
1
answer
5k
views
Nesting Linq-to-Objects query within Linq-to-Entities query –what is happening under the covers?
var numbers = new int[] { 1, 2, 3, 4, 5 };
var contacts = from c in context.Contacts
where c.ContactID == numbers.Max() | c.ContactID == numbers.FirstOrDefault()
...
2
votes
1
answer
371
views
Are elements returned by Linq-to-Entities query streamed from the DB one at the time or are they retrieved all at once?
Are elements returned by Linq-to-Entities query streamed from the database one at the time ( as they are requested ) or are they retrieved all at once:
SampleContext context = new SampleContext();...
2
votes
4
answers
2k
views
What is the most effective order to learn SQL Server, LINQ, and Entity Framework?
I am trying to get some advice on what order I should learn about SQL Server, LINQ, and Entity Framework to be able to better work with ASP.NET Webforms and MVC.
From what I've been able to learn so ...
2
votes
1
answer
345
views
Better way to read XML
We are storing config files as XML. With that being said, when reading the XML file, is it better to use LINQ to query the XML file or would using the XMLDocument and/or XMLNode classes better to use?
...
60
votes
11
answers
11k
views
Why is the use of abstractions (such as LINQ) so taboo? [closed]
I am an independent contractor and, as such, I interview 3-4 times a year for new gigs. I am in the midst of that cycle now and got turned down for an opportunity even though I felt like the ...
2
votes
1
answer
2k
views
Best way to remove list items from an existing record
Ok more of a conceptual question here:
Say I have an existing record of type Meeting. When I go to edit the meeting I have a listbox with all current meeting participants, and one with all employees. ...
-2
votes
2
answers
848
views
How do I tell the cases when it's worth to use LINQ?
Many things in LINQ can be accomplished without the library. But for some scenarios, LINQ is most appropriate.
Examples are:
SELECT - https://stackoverflow.com/questions/11883262/wrapping-list-...
5
votes
1
answer
746
views
What is Rainbow (not the CMS)
I was reading this excellent blog article regarding speeding up the badge page and in the last comment the author waffles (a.k.a Sam Saffron) mentions these tools:
dapper and a bunch of custom ...
8
votes
2
answers
4k
views
Does LINQ require significantly more processing cycles and memory than lower-level data iteration techniques?
Background
I am recently in the process of enduring grueling tech interviews for positions that use the .NET stack, some of which include silly questions like this one, and some questions that are ...
0
votes
2
answers
3k
views
LINQ TO SQL or ADO.NET? [closed]
What is the best choice LINQ TO SQL (.DBML) or using ADO.NET with procedures for a database with 29 tables and about 30 concurrent users that will run the system that I am going to build?
I know that ...
8
votes
3
answers
10k
views
Is querying KeyValue Pairs efficient compared to two-property objects?
I'm working on a webservice and I'm returning JSON. However, I'm returning a List<KeyValuePair<string, int>>, since that's all I'm really ever going to be dealing with (property => value)
...
6
votes
2
answers
4k
views
MVVM Reporting App Approach ? Data Access Layer?
I'm trying to follow the MVVM pattern in a reporting / statistics application that I'm making in C# / WPF.
I have made many model classes to hold properties as a starting point. Some of these models ...
3
votes
1
answer
645
views
Any changes/improvement for LINQ 2010 vs LINQ 2008
I'm VB.NET user and now learning LINQ. The book I'm reading now focus on LINQ 2008 VB.NET. I want to know whether there are changes/improvement in LINQ 2010?
p/s: I'm reading this book: Pro LINQ ...
3
votes
3
answers
4k
views
T-SQL stored procs orders of magnitude faster than LINQ
According to answers I've seen on stackoverflow, stored procedures (and to a lesser extent db functions) tend to perform better vs. LINQ + ORM frameworks (e.g. Entity Framework).
I want to determine ...
2
votes
2
answers
2k
views
Best practice modelling an active record entity using Linq-To-SQL as DAL
Currently I'm starting a new system on my company, and we are using a good separation between models, views and controllers, basically using Asp.Net MVC 3 for the user UI, and a C# class library for ...
-3
votes
7
answers
452
views
Selling LINQ To Management
I recently started working at a new company that currently doesn't use linq, but does use C# and the .net framework. I'm coming from a LINQ background, so I'm biased, but I still think there are a ...
7
votes
1
answer
14k
views
Entity Framework vs. Linq to SQL? [closed]
I'm a little bit confused about these two terms "Linq to SQL" and "Entity Framework". I have the general idea that both of them somehow allow you to refer to database tables as .net objects or ...
10
votes
4
answers
3k
views
LINQ vs Data Access Layer
I've taught myself always to handle any data access code in a completely separate 'layer' to my business logic and UI code. This has always been a very good architecture for me and any 'rules' or best ...
17
votes
7
answers
22k
views
What's the best Java equivalent to Linq? [closed]
Are there any libraries in Java that come close to providing the functionality of Linq?
4
votes
3
answers
2k
views
LINQ to SQL - Business logic in another assembly?
So I am trying my hand at this whole tiered application thing with ASP.NET 4. The software I've developed is a maintenance nightmare and it isn't very well organized. I've done some looking around ...
4
votes
3
answers
2k
views
Will there be any official LINQ like lambda based library for C++? [closed]
Given C++ gained lambdas with C++11, will there be any LINQ like higher order function library officially supported later? Or is there already such a library used in production quality code?
...
7
votes
4
answers
3k
views
Best algorithm/practice when creating a search mechanism for your database? [closed]
I have been designing a database where it is very important to provide users with a good search mechanism. So I was wondering what some of the best practices are for using keywords to search over ...
0
votes
3
answers
777
views
Are there any good resources for refactoring existing C# code to use LINQ while keeping your tests passing?
I've been teaching myself a little LINQ and an exercise I thought would be useful was to take my existing Project Euler C# code, which I built using Test Driven Development and gradually convert it to ...
24
votes
9
answers
13k
views
LINQ Style preference [closed]
I have come to use LINQ in my every day programming a lot. In fact, I rarely, if ever, use an explicit loop. I have, however, found that I don't use the SQL like syntax anymore. I just use the ...
0
votes
2
answers
298
views
C# Linq to <blank> which type is most used and which are most hated/unneeded [closed]
I have read and used many good Linq to . I have also read that some of the Linq to __ are not worth learning as there are better techniques. I was just wondering which of the bunch should I ...
0
votes
1
answer
294
views
Comparing features in a asp.net web application using different database methodologies [closed]
I have a webstore which sells components (it is a academic project) which looks like this. I have developed the same web application using following database methodologies:
MS Sql Server with Stored ...
16
votes
8
answers
24k
views
Senior Interview LINQ questions [closed]
I'm preparing a LINQ section in interview questions for senior programmers. What are the most interesting questions in LINQ to include? And why?
7
votes
3
answers
6k
views
In ASP.NET MVC3 controllers, where do you instantiate your DataContext?
In your ASP.NET MVC 3 applications that use a DataContext or DbContext, where do you instantiate your data access object?
Here is a non-exhaustive list of where I've seen it done:
Individually ...
17
votes
5
answers
3k
views
MVC, WCF, EF, LINQ - Is it just me? [closed]
...or are things getting more complicated?
It seems to me that you need to know a lot of stuff to 'properly' develop an MS web app these days. In the bad old days when we didn't know any better we ...
12
votes
5
answers
4k
views
LINQPad still being used much out there? [closed]
I'm trying to guage how popular and how used LINQPad is today. I'm just wondering if it's still a useful tool or not as VS and other tools have gotten better.
Furthermore, I am coding over LLBGen by ...
3
votes
4
answers
4k
views
Should I be learning Linq, Direct SQL Commands (in .net), EF or other? [closed]
Basically, I have a very good knowledge of plain old SQL coming from Classic ASP programming.
Over the past couple of months, I have been learning C# and today was my first full day at MVC 3 (Razor) ...
12
votes
4
answers
2k
views
What would you think about a new Java persistence tool, that's not really an ORM? [closed]
Persistence in Java
Over the past years, I have gathered experience in the field of persistence abstraction in Java, using concepts such as EJB 2.0, Hibernate, JPA and home-grown ones. They seemed to ...
43
votes
10
answers
17k
views
Does the usage of LINQ and Lambda Expressions lead to less readable code? [closed]
I'm having a discussion with a co-worker on Linq, I'll copy here:
Co-Worker: Lets be honest here. Linq
syntax sucks. It's confusing and
non-intuitive.
Me: oh come on, more
confusing than T-SQL?
Co-...