<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://linqinaction.net/utility/FeedStylesheets/atom.xsl" media="screen"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en"><title type="html">LINQ in Action roller</title><subtitle type="html" /><id>http://linqinaction.net/blogs/roller/atom.aspx</id><link rel="alternate" type="text/html" href="http://linqinaction.net/blogs/roller/default.aspx" /><link rel="self" type="application/atom+xml" href="http://linqinaction.net/blogs/roller/atom.aspx" /><generator uri="http://communityserver.org" version="2.1.61129.1">Community Server</generator><updated>2008-08-18T23:26:25Z</updated><entry><title>Select without From clause</title><link rel="alternate" type="text/html" href="http://linqinaction.net/blogs/roller/archive/2008/08/19/select-without-from-clause.aspx" /><id>http://linqinaction.net/blogs/roller/archive/2008/08/19/select-without-from-clause.aspx</id><published>2008-08-20T06:39:02Z</published><updated>2008-08-20T06:39:02Z</updated><content type="html">How can i convert this SQL statement to Linq to SQL. SELECT * FROM dbo.Adr LEFT OUTER JOIN dbo.Users AS u ON u.SystemUserId = dbo.f_SearchUserGuid() WHERE (EXISTS (SELECT 1 AS exp1 WHERE (dbo.Adr.OBUId IN (SELECT SBId FROM dbo.BU AS b WHERE (BId = u.BUId))))) Please help. Thanks Gisela Read More......(&lt;a href="http://linqinaction.net/blogs/roller/archive/2008/08/19/select-without-from-clause.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://linqinaction.net/aggbug.aspx?PostID=3888" width="1" height="1"&gt;</content><author><name>Anonymous</name><uri>http://linqinaction.net/members/Anonymous.aspx</uri></author></entry><entry><title>Using Microsoft Office Clients with Office Live Small Business (which is Based on SharePoint)</title><link rel="alternate" type="text/html" href="http://linqinaction.net/blogs/roller/archive/2008/08/19/using-microsoft-office-clients-with-office-live-small-business-which-is-based-on-sharepoint.aspx" /><id>http://linqinaction.net/blogs/roller/archive/2008/08/19/using-microsoft-office-clients-with-office-live-small-business-which-is-based-on-sharepoint.aspx</id><published>2008-08-19T22:30:00Z</published><updated>2008-08-19T22:30:00Z</updated><content type="html">The Dynamics CRM duo are at it again. Ben Riga and Girish Raja have put together an interesting video in which they talk about integration of Office with Dynamics CRM and Office Live Small Business (based on SharePoint). Office Live Small Business is a super way to enable collaboration with customers. Their demo takes great advantage of the web services that are exposed by Office Live Small Business. Worth watching. Read More......(&lt;a href="http://linqinaction.net/blogs/roller/archive/2008/08/19/using-microsoft-office-clients-with-office-live-small-business-which-is-based-on-sharepoint.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://linqinaction.net/aggbug.aspx?PostID=3886" width="1" height="1"&gt;</content><author><name>Anonymous</name><uri>http://linqinaction.net/members/Anonymous.aspx</uri></author><category term="SharePoint" scheme="http://linqinaction.net/blogs/roller/archive/tags/SharePoint/default.aspx" /></entry><entry><title>how to match condition with local veriable to LINQ?</title><link rel="alternate" type="text/html" href="http://linqinaction.net/blogs/roller/archive/2008/08/19/how-to-match-condition-with-local-veriable-to-linq.aspx" /><id>http://linqinaction.net/blogs/roller/archive/2008/08/19/how-to-match-condition-with-local-veriable-to-linq.aspx</id><published>2008-08-19T12:40:05Z</published><updated>2008-08-19T12:40:05Z</updated><content type="html">How to check condition from one LINQ Query Value to Another LINQ query? i am taking DocId from first LINQ query which is matching with second LINQ query. but i am getting error. first LINQ query is working fine and taking value. when i match with second LINQ query, here only i am getting error. how to match condition with local veriable to LINQ? Here i have given my code. var CheckCalendar = from resourceAvailabilityHeader in dwbContext.RESOURCEAVAILABILITYHEADER where (resourceAvailabilityHeader.ResourceCode...(&lt;a href="http://linqinaction.net/blogs/roller/archive/2008/08/19/how-to-match-condition-with-local-veriable-to-linq.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://linqinaction.net/aggbug.aspx?PostID=3872" width="1" height="1"&gt;</content><author><name>Anonymous</name><uri>http://linqinaction.net/members/Anonymous.aspx</uri></author></entry><entry><title>Chunking a Collection into Groups of Three</title><link rel="alternate" type="text/html" href="http://linqinaction.net/blogs/roller/archive/2008/08/19/chunking-a-collection-into-groups-of-three.aspx" /><id>http://linqinaction.net/blogs/roller/archive/2008/08/19/chunking-a-collection-into-groups-of-three.aspx</id><published>2008-08-19T12:27:00Z</published><updated>2008-08-19T12:27:00Z</updated><content type="html">Raw data for a LINQ query doesn’t always come in the form you want. Recently, I had some data like this: string [] source = new [] { "EW" , "Eric" , "8:00" , "DW" , "Dave" , "9:00" , "JA" , "Jim" , "8:00" }; You want to transform the above collection of strings into a collection of anonymous objects that are easier to work on, so you need to write a query that operates on groups of three. To solve this problem, you can take advantage that the Select extension method has an overload that passes an...(&lt;a href="http://linqinaction.net/blogs/roller/archive/2008/08/19/chunking-a-collection-into-groups-of-three.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://linqinaction.net/aggbug.aspx?PostID=3876" width="1" height="1"&gt;</content><author><name>Anonymous</name><uri>http://linqinaction.net/members/Anonymous.aspx</uri></author><category term="LINQ" scheme="http://linqinaction.net/blogs/roller/archive/tags/LINQ/default.aspx" /><category term="Useful Code Snippets" scheme="http://linqinaction.net/blogs/roller/archive/tags/Useful+Code+Snippets/default.aspx" /></entry><entry><title>Use a Lambda Expression for an Event Handler</title><link rel="alternate" type="text/html" href="http://linqinaction.net/blogs/roller/archive/2008/08/19/use-a-lambda-expression-for-an-event-handler.aspx" /><id>http://linqinaction.net/blogs/roller/archive/2008/08/19/use-a-lambda-expression-for-an-event-handler.aspx</id><published>2008-08-19T12:25:00Z</published><updated>2008-08-19T12:25:00Z</updated><content type="html">You can use lambda expressions to write an event handler, even for classes that predate C# 3.0 and the latest version of the framework. This can shorten your code, and make it easier to read. For example, the code to validate an XML tree using an XSD schema takes an event handler because it may return multiple errors or warnings for a single validation pass. An easy way to write this code is as follows: using System; using System.Linq; using System.Collections.Generic; using System.IO; using System.Xml;...(&lt;a href="http://linqinaction.net/blogs/roller/archive/2008/08/19/use-a-lambda-expression-for-an-event-handler.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://linqinaction.net/aggbug.aspx?PostID=3877" width="1" height="1"&gt;</content><author><name>Anonymous</name><uri>http://linqinaction.net/members/Anonymous.aspx</uri></author><category term="LINQ" scheme="http://linqinaction.net/blogs/roller/archive/tags/LINQ/default.aspx" /><category term="LINQ to XML" scheme="http://linqinaction.net/blogs/roller/archive/tags/LINQ+to+XML/default.aspx" /><category term="Useful Code Snippets" scheme="http://linqinaction.net/blogs/roller/archive/tags/Useful+Code+Snippets/default.aspx" /></entry><entry><title>Find Duplicates using LINQ</title><link rel="alternate" type="text/html" href="http://linqinaction.net/blogs/roller/archive/2008/08/19/find-duplicates-using-linq.aspx" /><id>http://linqinaction.net/blogs/roller/archive/2008/08/19/find-duplicates-using-linq.aspx</id><published>2008-08-19T12:23:00Z</published><updated>2008-08-19T12:23:00Z</updated><content type="html">Sometimes you need to find the duplicates in a list. I’m currently developing a little utility that tests code in a word processing document (to be blogged soon). Each code snippet in the document has an identifier, and one of the rules that I’m imposing on this code testing utility is that there should be no duplicate identifiers in the set of documents that contain code snippets to be tested. An easy way to find duplicates is to write a query that groups by the identifier, and then filter for groups...(&lt;a href="http://linqinaction.net/blogs/roller/archive/2008/08/19/find-duplicates-using-linq.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://linqinaction.net/aggbug.aspx?PostID=3878" width="1" height="1"&gt;</content><author><name>Anonymous</name><uri>http://linqinaction.net/members/Anonymous.aspx</uri></author><category term="LINQ" scheme="http://linqinaction.net/blogs/roller/archive/tags/LINQ/default.aspx" /><category term="Useful Code Snippets" scheme="http://linqinaction.net/blogs/roller/archive/tags/Useful+Code+Snippets/default.aspx" /></entry><entry><title>Add an entity that is not new</title><link rel="alternate" type="text/html" href="http://linqinaction.net/blogs/roller/archive/2008/08/19/add-an-entity-that-is-not-new.aspx" /><id>http://linqinaction.net/blogs/roller/archive/2008/08/19/add-an-entity-that-is-not-new.aspx</id><published>2008-08-19T12:10:58Z</published><updated>2008-08-19T12:10:58Z</updated><content type="html">Hello, This is about "An attempt has been made to Attach or Add an entity that is not new, perhaps having been loaded from another DataContext". I have read a lot of threads and blog pots about this, but I haven't been able to pass this issue. I have an ASP.NET project and I keep an entity in Session, so that I can add other entities related to my entity. In the end, I want to persist all by calling InsertOnSumbit for the first entity. Here is the code: Code Snippet BusinessLayer.admin.BillEntry...(&lt;a href="http://linqinaction.net/blogs/roller/archive/2008/08/19/add-an-entity-that-is-not-new.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://linqinaction.net/aggbug.aspx?PostID=3873" width="1" height="1"&gt;</content><author><name>Anonymous</name><uri>http://linqinaction.net/members/Anonymous.aspx</uri></author></entry><entry><title>LINQ to SQL: Cannot order by Link&lt;T&gt; deferred property</title><link rel="alternate" type="text/html" href="http://linqinaction.net/blogs/roller/archive/2008/08/19/linq-to-sql-cannot-order-by-link-t-deferred-property.aspx" /><id>http://linqinaction.net/blogs/roller/archive/2008/08/19/linq-to-sql-cannot-order-by-link-t-deferred-property.aspx</id><published>2008-08-19T11:40:48Z</published><updated>2008-08-19T11:40:48Z</updated><content type="html">I have a class called "OrganizationUnits" mapped to a table "t.OrganizationUnits". I use LINQ to SQL and [Column] attributes to map this class and its properties to a table. This class declares a property which is deferred-loaded by using the Link structure: [Table(Name = "t.OrganizationUnits")] [DataContract] public class OrganizationUnit{ [... more properties omitted ...] private Link _RecursiveName; /// ///recursive name of OU tree (readonly, lazy loaded) /// [Column(Storage = "_RecursiveName",...(&lt;a href="http://linqinaction.net/blogs/roller/archive/2008/08/19/linq-to-sql-cannot-order-by-link-t-deferred-property.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://linqinaction.net/aggbug.aspx?PostID=3875" width="1" height="1"&gt;</content><author><name>Anonymous</name><uri>http://linqinaction.net/members/Anonymous.aspx</uri></author></entry><entry><title>Checking for changes in LINQ to SQL</title><link rel="alternate" type="text/html" href="http://linqinaction.net/blogs/roller/archive/2008/08/19/checking-for-changes-in-linq-to-sql.aspx" /><id>http://linqinaction.net/blogs/roller/archive/2008/08/19/checking-for-changes-in-linq-to-sql.aspx</id><published>2008-08-19T11:23:45Z</published><updated>2008-08-19T11:23:45Z</updated><content type="html">Hi guys, I have a form which has its fields bound using a binding source to my LINQ file, in this case a Products table. Now this form can be loaded with data from the database using the following code: Code Snippet ''' ''' Finds the record. ''' Private Sub FindRecord() mProduct = ( From product In mDb.Products _ Where product.ProductID = Me .ProductId _ Select product).First If mProduct Is Nothing Then Dim message As String = "The selected product record has been deleted" &amp; vbNewLine &amp; vbNewLine...(&lt;a href="http://linqinaction.net/blogs/roller/archive/2008/08/19/checking-for-changes-in-linq-to-sql.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://linqinaction.net/aggbug.aspx?PostID=3874" width="1" height="1"&gt;</content><author><name>Anonymous</name><uri>http://linqinaction.net/members/Anonymous.aspx</uri></author></entry><entry><title>Check for uniqueness before Inserting</title><link rel="alternate" type="text/html" href="http://linqinaction.net/blogs/roller/archive/2008/08/19/check-for-uniqueness-before-inserting.aspx" /><id>http://linqinaction.net/blogs/roller/archive/2008/08/19/check-for-uniqueness-before-inserting.aspx</id><published>2008-08-19T10:50:59Z</published><updated>2008-08-19T10:50:59Z</updated><content type="html">Hi, I am trying to insert a row into my table but before doing that i want to check if that given Name(unique key) already exists.If so i should not be able to insert.I have made changes to the datacontextdesigner class to add the following code partial void InsertProgram(Program instance) { //here i should be able to compare the name i have entered on my grid with the existing names in this table. } Can anybody help me here ? Read More......(&lt;a href="http://linqinaction.net/blogs/roller/archive/2008/08/19/check-for-uniqueness-before-inserting.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://linqinaction.net/aggbug.aspx?PostID=3887" width="1" height="1"&gt;</content><author><name>Anonymous</name><uri>http://linqinaction.net/members/Anonymous.aspx</uri></author></entry><entry><title>Severe execution time difference between native and LINQ??</title><link rel="alternate" type="text/html" href="http://linqinaction.net/blogs/roller/archive/2008/08/19/severe-execution-time-difference-between-native-and-linq.aspx" /><id>http://linqinaction.net/blogs/roller/archive/2008/08/19/severe-execution-time-difference-between-native-and-linq.aspx</id><published>2008-08-19T10:15:01Z</published><updated>2008-08-19T10:15:01Z</updated><content type="html">I have a LINQ to SQL query that selects product information. When the program is run and the query is executed against the database, it always times out. I set up SQL Profiler and logged the activity going on, and made sure only my query was being excuted. When I ran my program, the query took the following times: CPU: 29328 Reads: 1769214 Duration: 30001 I copied the statement being executed strait out of SQL Profiler, and ran it in the database directly. The timings for hte second run: CPU: 109...(&lt;a href="http://linqinaction.net/blogs/roller/archive/2008/08/19/severe-execution-time-difference-between-native-and-linq.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://linqinaction.net/aggbug.aspx?PostID=3882" width="1" height="1"&gt;</content><author><name>Anonymous</name><uri>http://linqinaction.net/members/Anonymous.aspx</uri></author></entry><entry><title>multiple join reference, syntax?</title><link rel="alternate" type="text/html" href="http://linqinaction.net/blogs/roller/archive/2008/08/19/multiple-join-reference-syntax.aspx" /><id>http://linqinaction.net/blogs/roller/archive/2008/08/19/multiple-join-reference-syntax.aspx</id><published>2008-08-19T10:04:08Z</published><updated>2008-08-19T10:04:08Z</updated><content type="html">Code below does not compile but it seems obvious as VB.NET supports it but C# not... (I am missing something!) var query = from t in Texts join o in bookchapteralineas on t.BookChapterAlineaid equals o.bookchapteralineaid &amp;&amp; t.AlineaId equals o.AlineaId select t; The red color errs. Thanks! Read More......(&lt;a href="http://linqinaction.net/blogs/roller/archive/2008/08/19/multiple-join-reference-syntax.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://linqinaction.net/aggbug.aspx?PostID=3883" width="1" height="1"&gt;</content><author><name>Anonymous</name><uri>http://linqinaction.net/members/Anonymous.aspx</uri></author></entry><entry><title>LINQ, select in a datetime</title><link rel="alternate" type="text/html" href="http://linqinaction.net/blogs/roller/archive/2008/08/19/linq-select-in-a-datetime.aspx" /><id>http://linqinaction.net/blogs/roller/archive/2008/08/19/linq-select-in-a-datetime.aspx</id><published>2008-08-19T09:43:29Z</published><updated>2008-08-19T09:43:29Z</updated><content type="html">Hi there, Please, how can I write this code using LINQ. select mnts . NumSeq , usr . NomEmpUsr , minEsp . DscEsp , mnts . AssMnt , minTra . DatRecTrmMnt from dbo . SIC_Minuta mnts inner join dbo . SIC_MinutaEspecie minEsp on mnts . IdeEspMnt = minEsp . IdeEspMnt inner join dbo . SIC_Usuario usr on mnts . IdeEmpUsr = usr . IdeEmpUsr inner join dbo . SIC_MinutaTramite minTra on mnts . IdeMnt = minTra . IdeMnt where convert ( varchar ( 10 ), minTra . DatRecTrmMnt , 103 ) = '12/08/2008' thanks!! Read...(&lt;a href="http://linqinaction.net/blogs/roller/archive/2008/08/19/linq-select-in-a-datetime.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://linqinaction.net/aggbug.aspx?PostID=3884" width="1" height="1"&gt;</content><author><name>Anonymous</name><uri>http://linqinaction.net/members/Anonymous.aspx</uri></author></entry><entry><title>Linq to XML result in GridView</title><link rel="alternate" type="text/html" href="http://linqinaction.net/blogs/roller/archive/2008/08/19/linq-to-xml-result-in-gridview.aspx" /><id>http://linqinaction.net/blogs/roller/archive/2008/08/19/linq-to-xml-result-in-gridview.aspx</id><published>2008-08-19T09:08:50Z</published><updated>2008-08-19T09:08:50Z</updated><content type="html">Hello, I have a XML file with parts information, which includes Part Name, Description, and Image. I am using Linq to XML to load and parse XML file, I bind results to a GridView control with allow paging enabled. It is giving message that the source for GridView control does not support Server Side paging. How do I convert it or set it up as DataSet or Dataview so I can use the paging in Gridview? Here is the Code; Code Snippet string xFile = XDocument .Load( "products.xml" ).ToString(); XDocument...(&lt;a href="http://linqinaction.net/blogs/roller/archive/2008/08/19/linq-to-xml-result-in-gridview.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://linqinaction.net/aggbug.aspx?PostID=3881" width="1" height="1"&gt;</content><author><name>Anonymous</name><uri>http://linqinaction.net/members/Anonymous.aspx</uri></author></entry><entry><title>One Linq2Sql class for many tables?</title><link rel="alternate" type="text/html" href="http://linqinaction.net/blogs/roller/archive/2008/08/18/one-linq2sql-class-for-many-tables.aspx" /><id>http://linqinaction.net/blogs/roller/archive/2008/08/18/one-linq2sql-class-for-many-tables.aspx</id><published>2008-08-19T06:26:25Z</published><updated>2008-08-19T06:26:25Z</updated><content type="html">I must be searching incorrectly, either that or I need to fall back and start at the very beginning with Linq (which probably wouldn't hurt anyway)! This is my first application of linq. I essentially want to have a single class which is used for data access against any number of tables that look identitical. To get a little more specific, I am looking to write some code against Service Broker queues. All Service Broker 'queues' look exactly alike. I'm looking to cruft up a 'CustomerQueue', or 'OrdersQueue',...(&lt;a href="http://linqinaction.net/blogs/roller/archive/2008/08/18/one-linq2sql-class-for-many-tables.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://linqinaction.net/aggbug.aspx?PostID=3880" width="1" height="1"&gt;</content><author><name>Anonymous</name><uri>http://linqinaction.net/members/Anonymous.aspx</uri></author></entry></feed>