I need to select from varying levels of reporting department tables, i.e. Dept1, Dept2, Dept3, ect. [1] depending on which reporting level the user chooses. How can I dynamically express the 'table' to select from based on a given string parameter, which is the table name?
[1] Easy points (lets talk) for anyone that can help me out of ...
I have a table containing a list of customers, a second table containing orders placed by my customers and a third table containing the line items for the orders.
I would like to be able to use a Linq query to get the customer name, the number of orders and the total value of all the orders placed by this customer.
Assuming the follow...
For my client's sake, I have forgone pride and dignity and opted for the exampled means of choosing an entityset to select from, but I need to join this to another, fixed, entityset, and this challenge is beyond me today.
I need to project a set of attributes from both Department*n,* and another entity set called Sites. I can join Depar...
I am querying an HTML file with LINQ-to-XML. It looks something like this:
<html>
<body>
<div class="Players">
<div class="role">Goalies</div>
<div class="name">John Smith</div>
<div class="name">Shawn Xie</div>
<div class="role">Right Wings</div>
<div class="name">Jack Davis</div>
...
I am trying to perform a query on a query result, but I am getting an error: “The method or operation is not implemented”. Can I chain queries in this way?
For example, I have a Northwind typed DataSet. I do:
queryResult = From product In NorthWindDataSet.Products
Where (product.UnitsOnOrder > CInt(txtUnitsOnOrde...
I've encountered a strange behavior in a .NET application that performs some highly parallel processing on a set of in-memory data.
When run on a multi-core processor (IntelCore2 Quad Q6600 2.4GHz) it exhibits non-linear scaling as multiple threads are kicked off to process the data.
When run as a non-multithreaded loop on a single cor...
E.g. Input string str = "1111222233334444";
return value ArrayList A where A[0] = "1111", A[1] = "2222", etc.
Use of Linq or reg ex would be good.
...
I have a reference table with all sorts of controlled value lookup data for gender, address type, contact type, etc. Many tables have multiple foreign keys to this reference table
I also have many-to-many association tables that have two foreign keys to the same table. Unfortunately, when these tables are pulled into a Linq model and th...
For example, I have an array of floating point numbers:
float[] numbers = new float[] { 1, 34, 65, 23, 56, 8, 5, 3, 234 };
If I use:
Array.Sort(numbers);
Then the array is sorted by the size of the number.
I want to sort the numbers by another criteria, so element A should go before element B if f(A) < f(B), rather than the usual ...
If I have a Customer class and want to add a Orders property which would return all orders for this customer, what would be the appropriate type for the Orders property?
Some of the possible choices I can think of:
List
IList
IEnumerable
...
I appreciate that similar questions have been asked before, but I am struggling to invoke the Linq Where method in the following code. I am looking to use reflection to dynamically call this method and also dynamically build the delegate (or lambda) used in the Where clause. This is a short code sample that, once working, will help to fo...
Does Enumerable.GroupBy from LINQ to Objects preserve order of elements in the groups?
...
I'm using ASP.NET MVC and Azure Table Storage in the local development fabric. My pagination code is very slow when working with a large resultset:
var PageSize = 25;
var qResult2 = from c in svc.CreateQuery<SampleEntity>(sampleTableName)
where c.PartitionKey == "samplestring"
selec...
Hi there,
In my datbase I have TableA, TableB and TableC
TableB has just 2 columns, the primary key of TableA and TableC, so it really defines a one to many relationship between the two tables
What i want to do using SQL is:
SELECT *
FROM TablesA a
JOIN TablesB b ON a.AID = b.AID
WHERE b.BID = 1
In the Entity Framwork is doesn't c...
I've been using linq2sql on a few projects, but i decided it was time to try out EF as its supposed to be more powerful and better. There are a few things that is really annoying tho.
One of them is projecting a result into a list, this works well in l2sql but not in EF.
public class bo.Transaction
{
public long Id { get; set; }
pub...
I am creating XML using Linq to XML and C#. It all works great except when I need to manually add in a row in the XML. This row is only added if I have a value to pass through to it, otherwise I just ignore the entire tag.
I use XElement.Load to load in the string of text that I store in a string but when I attach it to the XML it alway...
I am trying to perform a straighforward update using LinqToSQL, and just cannot get it to work.
Here's the data model: there is a timesheet_entry and customer. One customer has many timesheet_entries. It's a simple foreign key relationship.
If I'm editing an existing timesheet_entry, I get an exception if I change the customer_id.
Her...
Wikipedia states that the Specification Pattern is where business logic can be recombined by chaining the business logic together using boolean logic. With respect to selecting filtering objects from lists or collections it seems to me that Dynamic LINQ allows me to accomplish the same thing. Am I missing something? Are there other be...
Is there any way to make NHibernate.Linq generate a like query on an integer field? The SQL that I want it to generate is:
select IntegerColumn
from Table
where IntegerColumn like '%StringValue%'
I've tried something like:
from entity in _session.Linq<Entity>
where entity.IntegerColumn.ToString().Contains(StringValue)
select enti...
I have an application I'm working on where I want to loop through some data where a flag in the data is set to 1 or 2 and print it to screen.
The idea I'm working on using is from one of the MVC tutorials:
<ul>
<% For Each m As Movie In ViewData.Model%>
<li><%= m.Title %></li>
<% Next%>
</ul>
But I want to do similar to the abo...