I would like to UCASE or ToUpper a column in my LINQ query.
var query = from rsn in db.RSLReasons
orderby rsn.REFCMNT
select new {rsn.REFCODE, rsn.REFCMNT};
dtReasons = query.ToADOTable(rec => new object[] { query });
If I try to run the following code:
var query = from rsn in db.RSLReasons
order...
Hi,
I have a collection of objects, representing a folder structure.
I'd like to set the property "FileExtenson" to null, if its a folder.
This is as far as I've got. Can anyone help?
var items=MyClass.All().ToList();
items.ForEach(x=>x.FileExtension = string.empty).Where(y=>y.FileExtension == "folder").ToList());
Frank
...
I have a Data Class called MyTable, and the source property is TABLE (table name in database).
How to retrieve the source property given a Linq<Table>?
DBDataContext db = new DBDataContext();
db.MyTable.GetSource() ??
...
I looked at this http://stackoverflow.com/questions/401756/parsing-json-using-json-net question and answer and it's close to what I need. The critical difference Is that I need to parse an array of x,y pairs that form one or more lines per record. Here's an example of my input
{
"displayFieldName" : "FACILITYID",
"fieldAliases" : {
"FA...
I'm using the standard visitor pattern to iterate through a LINQ expression tree in order to generate dynamic SQL WHERE clauses.
My issue is that unlike C#, you can't use a standalone boolean expression in SQL; you have to compare it to either 1 or 0.
Given this hypothetical lambda expression:
h => h.Enabled || h.Enabled == false
It...
So, I've spent a good amount of time using ContinuousLinq to bind collections to WPF using LINQ in my client app. Now I get to testing and find out that ComboBoxes do not support collection change notifications cross-thread.
Does anyone know of a Bindable LINQ solution that has an option to force change event to be raised on a given UIT...
I'm having a compiled query after which I've stacked a non-compiled query via an IQueryable extension method.
var resultSet = CompiledQueries.GetNewCustomers(datacontext).OrderBy(criteria.OrderExpression);
When I put a breakpoint at a non-compiled query, I can usually see the SQL expression generated. However, when I put a breakpo...
Hello, how can I create a dynamic ORDERBY in my LINQ CompiledQuery (e.g. supply Order Field and Direction as parameters for the compiled query)?
...
I have a database with a table that contains Name and CompanyName. They are mutually exclusive (either field is null). Using LINQ to SQL, I'm trying to order these two "into" each other (but not in-memory, I would like this done by SQL Server 2008) so that I can get a single column "DisplayName" which will do this:
Record Name ...
Hi,
I have a [Flags] enum like this:
[Flags]
public enum Status
{
None = 0,
Active = 1,
Inactive = 2,
Unknown = 4
}
A Status enum may contain two values such as:
Status s = Status.Active | Status.Unknown;
Now I need to create a linq query (LINQ to ADO.NET Entities) and ask for records whose status is s above, that is Acti...
Hi,
I just started playing with lambdas and Linq expression for self learning. I took the simple factorial problem for this. with the little complex scenario where find the factorial for given n numbers (witout using recursive loops).
Below the code i tried. But this is not working.
public void FindFactorial(int range)
{
var res...
Hi,
I have a collection of objects as Dim XXX As IEnumerable(Of MyObject) which has been populated. There is a property in MyObject that I want to group by, for example MyObject.MyCode.
Looking through the LINQ examples it is not clear what the Group XX By INTO syntax is doing and I can't understand it.
So what I'm after is the abilit...
Question is How do a return a List of B with all the entities in children of all Parents without resorting to the type of code below, I was thinking u must be able to acheive the same within a single linq query?
Class Parent {
public Title,
public children List<B>,
}
data = List<A>
var childLists = from x in x.Parents select x...
Is LINQ a new feature in .NET 4.0? Older versions like .NET 3.5 doesn't have?
I am interested to know about this as it seemed to be somehow related to my the project I am working on.
What is LINQ useful for? It seemed to be able to build Expression Tree. What is an actually Expression Tree? Is LINQ able to extract info like class, met...
I have gone to an interview at toyota and was very surprised the interviewer asked me questions about Linq. I can't believe Linq is being used by these big corporations. Do you guys use linq where you work at?
...
I'm triyng to do a quick Haskell-like aggregation in Linq (C#), to turn a List into a string in the format "i^j^k..." etc.
is this possible in one query, or should I just do it the old-fasioned
foreach (int i in list)
{
string+= i + "^"
}
(p.s. yes, that's pseudocode and wouldn't compile.)
...
Hello all.
I'm wondering if my method below of comparing an array of strings (or any simple type really) has any performance repercussions.
bool AreValuesEqual(List<string> oldFieldValue, List<string> newFieldValue)
{
if (oldFieldValue.Count != newFieldValue.Count)
return false;
var list1 = oldFieldVa...
I am reading up on the entity framework and the author is explaining ESQL, canonical functions, and Linq. he does not explain what canonical functions are and why they are needed. The code that he uses in the book can be easily converted to Linq. Where do canonical functions play in the Entity framework? Can I use canonical functions ins...
With a WCF built on top of a DB containing around 200 tables and Entity Framework, it takes lot of time (around 2 mins) to perform login the first time after building the WCF.
Stepping into the code revealed the IQueryable.Count method to be the culprit.
This happens only the first time after building the WCF code. Consecutive executio...
If Not IsPostBack Then
Dim q=From f In System.Drawing.FontFamily.Families _
Select f.Name
ListBox1.DataSource = q
ListBox1.DataBind()
End If
I'm new to LinQ and I'm following a VB.Net tutorial so I don't know Linq in C#. Can anyone translate this to C# for me?
...