I recently started to learn about LINQ and came across the OrderBy extension method. This initially excited me because the syntax seemed much nicer than the Sort method that we use all over the place for Generic Lists.
For example, when sorting a list of languages, we normally do something like:
neutralCultures.Sort((x, y) => x.English...
Is it possible to pass parts of a linq Query into a function?
I want create a common interface for my DAL that always uses the same query interface. For example,
List<T> Get(Join j, Where w, Select s){
return currentDataContext<T>.Join(j).Where(w).Select(s).ToList();
}
Is this sort of thing possible? I'm thinking it wo...
The IQueryable results is queried from my db using LINQ, How do I add a new record to the IQueryable result.
...
I have a GridView bound to an ICollection<UserAnswer> that needs to show two columns:
<asp:GridView ID="UserAnswersGridView" runat="server">
<Columns>
<asp:BoundField DataField="Question.Name" HeaderText="Question Name" SortExpression="QuestionID" />
<asp:BoundField DataField="Score" HeaderText="Score" SortExpressi...
When is the "unit of work" no longer a "unit"? Which scenario is better on resources? THe first creates one connection wheras the second creates 4.
using (DataContext dc=new DataContext)
{
var orders= from o in dc.orders
select ( new Product { property a= from a in ..join... select x,
...
I'm a newbie when it comes to LINQ...
I have an IEnumerable generic list that contains answers with different versions (each with an FK to the question). From this list I need to get a dictionary of latest version answers only.
A very simplified class diagram:
Question
-ID
-question
- ...other properties
Answer
-ID
-Version
-Questio...
Is there a nice way to split a collection into 'n' parts with LINQ ?
Not necessarily even of course
...
I have a table in a ASP.NET MVC application that I want to be sortable (serverside) and filterable using AJAX. I wanted it to be fairly easy to use in other places and didn't feel like hardcoding the sorting and filtering into query expressions so I looked for a way to build the expressions dynamically and the best way to do this I found...
I heard lots of reviews on the book Linq in Action, but it does not cover Linq to Entities.
Please provide your feedback on the books you may have read.
...
Ok, so I have an abstract class called Product. I have 3 tables called Items, Kits, and Packages that implement Product. Product has a public property that exposes the object's primary key.
That said I have a form where I pass a product. I would would like to pull that product out of a fresh datacontext without having to write a big ...
As a fairly junior developer, I'm running into a problem that highlights my lack of experience and the holes in my knowledge. Please excuse me if the preamble here is too long.
I find myself on a project that involves my needing to learn a number of new (to me) technologies, including LINQ (to OBJECTS and to XML for purposes of this pr...
Newbie to LINQ, and trying to write the following query...
select
f.Section_ID,
f.Page_ID,
f.SortOrder,
f.Type
from
(
select
Section_ID,
min(SortOrder) as minSortOrder
from
ContentPages
group by
Section_ID
) as x
inner join
ContentPages as f on
f.Section_ID = x.Section_ID and
f.SortO...
Hello,
I have multiple tables with an "id" component. I'd like to use LINQ to get an item from one of these tables with the correct LINQ-To-SQL type, but only using one CompiledQuery.
Here's an example that works currently. Say the object type defined in the DBML is "myitem" and its table is "myitems".
var getOneItem = CompiledQu...
What are Expression Trees in LINQ? Could someone point me to a resource that has code and explanation?
...
Have been looking at the MVC storefront and see that IQueryable is returned from the repository classes. Wondering if you are not using LINQ does it makes sense to return that object? In the case of LINQ in makes sense because of deferred execution, so adding filtering in the service layer makes sense, but if you don't use LINQ you wou...
What major features are missing from Linq-to-Sql?
Compatibility with other major SQL Database Engines (MySQL etc)
Mapping Many-to-Many relationships
Any others?
I have already developed a major project with Linq-to-Sql at it's DAL Heart. i hadn't developed using a relational data mapper before, so it was a learning curve coming from ...
Has anyone tried ASP.NET MVC using IronPython? Having done a lot of Python development recently, it would be nice to continue with the language as I go into a potential ASP.NET MVC project.
I'm especially interested in exploiting the dynamic aspects of Python with .NET features such as LINQ and want to know if this will be possible. T...
I have a truckload of xsd with plain SQL queries. I want to migrate to LINQ.
Is there a automated way to generate LINQ equivalents from SQL statements?
...
I need to declare the query variable outside the switch statement that way I would only have one variable that would handle different result of the LINQ Query. Please see the code below. Problem here is that I cannot infer a variable without initializing it
var query;
Switch(filter)
{
case 1:
var query = from c in Customers
...
Dear StackOverflow,
I'm trying to do the following in the VS2008 Linq O/R designer, SQL 2005:
I have a table called "Entity" with an autoincrementing primary key named "PKey", and another field called "Parent"
I've made a View from this table, calling it vwEmployees, with a simple where clause.
Add both to O/R designer. in O/R, set th...