I have three tables table1, table2 and table3
Table1
Id Data
1 Data1
2 Data2
3 Data3
Table2
Id Meta data
1 Meta data1
2 Meta data2
“ "
“ "
“ "
Table 3
Id Data ID Meta Data ID Value
1 Data1 Metadata1 Value1
2 Data1 Metadata2...
Hi there, this is my escenary, I Have a class called Plantilla that contains severals propertyes that allows bind a gridview in wpf, so that was working already, but users tells me that they need re-group the query by some field in database, so I prepare this snippet :
var dsTemplates = (from t in db.PLANTILLAs
...
Image you are creating a DB schema for a threaded discussion board. Is there an efficient way to select a properly sorted list for a given thread? The code I have written works but does not sort the way I would like it too.
Let's say you have this data:
ID | ParentID
-----------------
1 | null
2 | 1
3 | 2
4 | 1...
I have an XDocument object. I want to query for elements with a particular name at any depth using LINQ. When I use Descendants("element_name"), I only get elements that are direct children of the current level. What I'm looking for is the equivalent of "//element_name" in XPath...should I just use XPath, or is there a way to do it us...
I have to spend a fair portion of my time developing in dotnet 1.1, and as I'm sure anyone in a similar position will appreciate, the more I get used dotnet 2.0 and above, the more annoying it is to go back to the early version. I'm getting increasingly fed up of messing about with ArrayLists and the like when I want to be working with G...
What is the best way to ensure thread-safe Linq-to-XML, for writing?
We recently got overloaded on our web cluster and I had to pull a quick overloaded.aspx out of my butt to capture emails that people can be contacted with later when the site becomes more responsive. In my short 5 minute haste, I wrote this:
private static object Loc...
I have a Linqdatasource that groups the records in table:Routing by a field called SubmitTo. My select statement is this - "new (key as SubmitTo, Count() as Count, it as Routings)". Now the SubmitTo field is only a foreign key reference the primary key in table:Department which has a field:DeptName with the full name of the department. H...
I'm trying to create a generic function to help me select thousands of records using LINQ to SQL from a local list. SQL Server (2005 at least) limits queries to 2100 parameters and I'd like to select more records than that.
Here would be a good example usage:
var some_product_numbers = new int[] { 1,2,3 ... 9999 };
Products.SelectByP...
I'm trying to use Linq to return a list of ids given a list of objects where the id is a property. I'd like to be able to do this without looping through each object and pulling out the unique ids that I find.
I have a list of objects of type MyClass and one of the properties of this class is an ID.
public class MyClass
{
public int ...
Say I have an IEnumerable. For example, {2,1,42,0,9,6,5,3,8}.
I need to get "runs" of items that match a predicate. For example, if my predicate was
bool isSmallerThanSix(int number){...}
I would want to get the following output:
{{2,1},{0},{5,3}}
Is there a built-in function that accomplishes this?
So far I have this:
public s...
I am trying to traverse through a simple sitemap (adding and deleting elements on the fly.) This is the sample layout
<?xml version="1.0" encoding="UTF-8"?>
<urlset
xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.sitemaps.org/schem...
I'm just starting out with LINQ to Entities, and I'm trying to replicate a search we currently do in a stored procedure as a LINQ to Entities query. However, I can't seem to figure out the correct way to query properties of entities more than one "join" away from the starting point of my query.
For example, say I have tables Campaign, ...
0 vote down
star
1
I want to be able to share my datacontracts (classes generated in the linq to entities designer are decorated with the [DataContract] attribute.
I'm trying to use the architecture as detailed here: http://www.netfxharmonics.com/2008/11/Understanding-WCF-Services-in-Silverlight-2 and trying to reference my interfaces...
Big Subjective Question: I often find myself using LINQ to filter a set of objects and then, after the query, doing an old fashion foreach to perform an action on each of the results. Is there a good way of combining these two tasks such that an action is performed on each object that matches the Where() predicate? Almost like passing an...
I'm trying to write this as LINQ,
Original code:
For Each CurrentForm As Form In MyForms
AddLink(CurrentForm.GetLink())
Next
I'm a LINQ beginner, so far I'm not quite sure where to use and where not to. If in this case LINQ will do more harm then help, feel free to flame me.
Edit : You can assume that there is an overload for A...
In which situations I should use LINQ to Objects?
Obviously I can do everything without LINQ. So in which operations LINQ actually helps me to code shorter and/or more readable?
This question triggered by this
...
I create an IEnumerable object that just contains the nodes I want from an xml file:
IEnumerable<XElement> rosters = XDocument.Load("roster.xml")
.Elements("rosterlist")
.Elements("roster")
.Where(w => w.Element("di...
Hi,
How can I group result of a LINQ to SQL query by hours considering that the column type is DateTime?
...
Hi,
I've been having a problem binding a ListView to an Object using LINQ. It's best explained with a testcase I've created:
C#:
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
namespace WpfApplication1
{
public partial c...
Anyone have a good example of setting up a LinqDataSource entirely in code? I don't need help writing the LINQ query. I just need help setting up the flow of the code. The reason I want to do it in code is because the complexity of the query I need goes beyond the capabilities of the LinqDataSource wizard.
...