Group XDocument.Descandants
How to group xml element values XDocument.Descandants("Customer").GroupBy(c=>c.Element("ServiceId")); This is not working. Is there any way to group this? ...
How to group xml element values XDocument.Descandants("Customer").GroupBy(c=>c.Element("ServiceId")); This is not working. Is there any way to group this? ...
Say I have an entity that looks something like this simple example: MyEntity { int property1; int property2; int property3; } Now assume I have an IEnumerable list of these entites. Is there a LINQ query I can execute that would set the value of property1 to 100 for each entity in the list? I know I can do this via a foreach,...
Hi, I have an application that makes hundreds of calls to a third party web service. Each time a call is made the response is parsed into XElement and a series of operations are performed on it. The processed XElement is then added to an XDocument that is later saved to disk. Occasionally a response will include some bad data. In this...
var pom= from k in dataContext.student_gods where k.skgod==System.Convert.ToString(2002/03) select k; foreach(var i in pom){ var predmeti = from m in dataContext.student1s where m.id_stud ==System.Convert.ToString(i.id_stud) ...
I've a list of tasks. Ie I've struct like struct Task { public DateTime Completed { get; set; } public string TaskKind { get; set; } public float Effort { get; set; } } And I've a IList<Task>. Now I want to group the tasks based on the date and group by TaskKind on each day with the summed effort. For eg for I want to pri...
Ok, this is very weird. I'm using SubSonic 3.0 and Linq to select a list of IDs (and other properties) into a list of user-defined-objects. Like this: public class ListItem { public int C { get; set; } } public class ListItemWithID { public int ID { get; set; } ...
Hi everyone, Let's say I have a sequence. IEnumerable<int> sequence = GetSequenceFromExpensiveSource(); // sequence now contains: 0,1,2,3,...,999999,1000000 Getting the sequence is not cheap and is dynamically generated, and I want to iterate through it once only. I want to get 0 - 999999 (i.e. everything but the last element) I rec...
Just wondering whether anyone will still use Hibernate once they move to C# 3 Are these mutually exclusive?? ...
I have the following nhibernate mapping <class name="Customer"> <id name="Id"> <generator class="native"/> </id> <property name="Name"/> <set name="Invoices" cascade="all" lazy="false"> <key column="CustomerId"/> <one-to-many class="Invoice"/> </set> </class> <class name="Invoice"> <id name="Id"> <generator ...
This code doesn't return data from table: var pom = from k in dataContext.student_gods where k.skgod == System.Convert.ToString(2002/03) select k.id_stud; This code does return data from table: var pom = from k in dataContext.student_gods where k.skgod== "2002/03" ...
I have a function that works great in C# that I'm converting to VB.Net. I'm having an issue converting the result set to a generic list in VB.net. The code: Public Function GetCategories() As List(Of Category) Dim xmlDoc As XDocument = XDocument.Load("http://my_xml_api_url.com") Dim categories = (From category In xmlDoc.Descendan...
I have a listbox that is dynamically filled by certain values depending on what table has been selected from another list box. Once a value is selected, it is being graphed vs a date & time range. With my ignorance of linq: depending on what value is selected, the linq to sql statement I need to create to grab data from my database is di...
I am trying to create a matrix of doubles, representing a correlation between entities. Here's how I'm doing it via LINQ double[][] correlationsRaw = (from e in entitiesInOrder select (from f in entitiesInOrder select correlations.GetCorr...
In the following example, GetFilteredCustomers() works fine so I can send various letters which I want customers to have in their last name. But how can I build GetFilteredCustomersDynamic() which will enable me to send a full where clause that can be dynamically included in the LINQ statement? using System; using System.Collections.Ge...
Hi all, this is a homework question. I am doing diffs on our domain model and I've set it up so that I can iterate a list of operations that check for certian differences within the domain. I pass in the differencing function and the before and after states of the object graph to produce a result in the DiffContext - which is used late...
I am using LINQ to SQL classes, and have extended one (with a partial class) and added an extra property. I want to query on this property, so: (from p in db.TableName where p.CustomProperty=="value" select p) However this doesn't work. I get an error: The member 'TableName.CustomProperty' has no supported translation to SQL. At the...
Thanks to those who answered my last question I got the code below to work which allows the developer to send multiple where clauses to a method which includes each of them in a LINQ statement. However, how can I get the inclusion of the where clauses to be dynamic? Instead of this: return customers .Where(whereClauses[0]) ...
I have a strange problem with a Windows Forms event. To be exact, it's a KryptonHeaderGroup's ButtonSpec Click event, but it also happens with a plain vanilla System.Windows.Forms.Button. In the click event, the user interface is brought down (there's a label and a cancel button left), and then an expensive LINQ query is built from prev...
Thanks to those who answered my last couple questions, I got the following code to work which allows you to send a collection of Where clauses to a method which are all attached to a LINQ query. This is going to work for the case at hand that I need. However, what is the best approach to extend this so that: OrderBy clauses can be sen...
Can it be advantageous for a method to return IOrderedEnumerable instead of IEnumerable? ...