linq

Handling LINQ Concurrency Issues?

I'm writing a program that can be used by multiple users and concurrency is a big concern of mine. I wrote the program and didn't even know about the subject, and now that I'm in multi-user testing, things are starting to blow up. I want to be able to re-try the action if it fails, but don't know how. My code shows a message box if ...

Linq: Select First Items from the Child List?

I have the following one-to-many relation between two objects. Parent --> IList<Child> Now, I have a List of Parent objects and I want the First Child of each parent in the list. What is the best way to do this using Linq? ...

Return CopyMost in LINQ

I am not sure if CopyMost is the correct term to use here, but it's the term my client used ("CopyMost Data Protocol"). I have a set of data: Increment Value .02 1 .04 1 .06 1 .08 2 .10 2 I need to return which Value occurs the most "CopyMost". In this case, the value is 1. Rig...

Dynamic Linq : is it stable ?

Dynamic Linq is provided as a sample for VS2008, not as a "real" project (no official site, no support, no issue tracking, no new releases...). So I was wondering, how reliable is it ? Is it suitable for production use ? ...

Subsonic 3 LINQ Projection issue, fixed or no?

I'm currently experiencing the issue mentioned here (and several other places): http://stackoverflow.com/questions/1105052/subsonic-3-linq-projection-issue This is occurring using the 3.0.0.4 release package, and it also occurs when I grab the latest from GitHub and build it. I am using the LINQ Templates. I have this code: v...

C# LINQ calculated Group By

To take it down to brass tacks, I have a List containing 100 various records. A Car has a Year, Make and Model. I need to be able to : order this according to Year, but I need to: have all Cars that are Ford Explorers appear as a "group" at the end of my List (also ordered according to Year) I'm not sure if I'll have to...

selection using LINQ

Hi, I have a sample xml file that looks like this: <Books> <Category Genre="Fiction" BookName="book_name" BookPrice="book_price_in_$" /> <Category Genre="Fiction" BookName="book_name" BookPrice="book_price_in_$" /> <Category Genre="NonFiction" BookName="book_name" BookPrice="book_price_in_$" /> <Category Genre="Children" Bo...

Stress Testing Multi-User Application?

I have an application that I'm building that has had concurrency problems in the past. This was before implementing any LINQ error handling. Now, I have some LINQ error handling added to my code, and I was wondering if you could give me tips about how to stress test the hell out of my application. It is super important that everything w...

Full object projection with additional values in LINQ

Is it possible to project every property of an object and add more, without specifically listing them all. For instance, instead of doing this: var projection = from e in context.entities select new QuestionnaireVersionExtended { Id = e.Id, Versio...

Thread Safing "Select" Linq Queries?

I understand how editing rows can cause concurrency issues, but concurrency issues being caused by selecting rows is something I do not understand. If a query selects data from a database, how can a concurrency issue arise? Is it if there is a change made to the data I'm selecting, things will blow up? In any case, if there is a con...

LINQ inner join

I have two collections: List<int> ids; List<User> users; Where User has id, name, etc. I would like to inner join these two collections and return a new List<int> with ids from the first collection which are also in the second collection (User id's). I am new to LINQ and don't know where to start. Thanks. ...

How do I use Roy's dynamic Linq to join function

I am unfamiliar with the Syntax. How do i use your join function for the Dynamic Linq Join? Jeff Armbruster ...

Linq preprocessor?

I think it would be useful to have a linq preprocessor where it can "preprocess" your linq expression into regular c# statements like .Select() .Group() etc. This would be useful for learning what goes on behind the scenes in linq, learning linq or debugging a complex linq expression. Does such a tool or facility exist? I couldn't fin...

A LINQ with XML question

Hi all: How can I use LINQ to retrieve a specific value of Supported attribute nased on the condition URL="localhoist"? Thank you. <SomeSetting> <Setting URL="abc.com" Supported="sb.new,mgrsma" /> <Setting URL="localhost" Supported="GG,LLmgrsma,FF1,FF3" /> <Setting URL="def.zxy.com" Supported="xyz" /> </SomeSetting> ...

How to use var more than once in linq?

var ID, x,y switch(ItemTypeNo) { case ItemType.A : ID = from s in cntx.Tablo1 break; case ItemType.B : ID = from s in cntx.Tablo2 break; case ItemType.C : ID = from s in cntx.Tablo3 break; } ...

Disposing an IDisposable in Linq

(This is a follow on from a comment on an answer to this question) 18 months after I posted it, someone spotted a bug in one of my Linq examples, where I use an IDisposable half way through a method chain, which never gets disposed. I attempted to write an extension method to handle this: public static IEnumerable<R> Using<T, R>( ...

C# LINQ select from list

Hi i have a list of event Ids returned from an xml document as shown below public IEnumerable<EventFeed> GetEventIdsByEventDate(DateTime eventDate) { return (from feed in xmlDoc.Descendants("Show") from ev in feed.Elements("Event") where Convert.ToDateTime(ev.Attribute("Date").Value).ToShort...

How can i use select to string in linq?

How cani use below codes string id = ( from in .....) how? using (StockProcedureDataContext stock = new StockProcedureDataContext()) { id = (from m in stock.StockTools from ss in stock.RefStockStatus where (m.statusid == 3 || m.statusid == 5) How can i do above...

How can i use "COALESCE(SUM..." in linq?

...

How can i use unioan and nested from linq?

How can i convert to sql to linq . i don't understand nested select query. i need linq codes. Please help me:(((( SELECT @id=id FROM (SELECT id,workorder AS workorderno ,CAST(jobseqno AS int) AS jobseqno FROM dbo.CTask UNION ALL SELECT id,workorderno,cardno AS jobseqno FROM dbo.NonRoutineCard UNION ALL SELECT i...