If you are looking to follow this series, be sure to subscribe to my RSS feed at http://feeds.jasongaylord.com/JasonNGaylord or my Twitter account at http://twitter.com/jgaylord. This series can be followed by using the Hot Links tag. Series Post #7 Daily Quote – Great quote: "The mind can only absorb what the seat can endure" ~ @mrrodd (Posted by Dan Wahlin) .NET Languages – C# and Visual Basic CLR Inside Out – Understanding the CLR Binder (Suggested by Kevin Tunis) Microsoft to turn .Net Micro Framework code, support over to the community – Mary Jo Foley Architecture, Design Patterns, and Testing Top … Continue reading Technology Related Links for May 6th, 2009
If you are looking to follow this series, be sure to subscribe to my RSS feed at http://feeds.jasongaylord.com/JasonNGaylord or my Twitter account at http://twitter.com/jgaylord. This series can be followed by using the Hot Links tag. Series Post #5 Quote of the day – "Requirements are like water. They’re easier to build on when they’re frozen." (Posted by Elijah Manor) .NET Languages – C# and Visual Basic Getting a Recursive FTP File List in .Net – Michael C. Neel Multithreading: creating threads – Luis Abreu What Should Microsoft do for .NET Open Source? – Rob Conery Architecture, Design Patterns, and Testing … Continue reading Technology Related Links for May 4th, 2009
For those not at the MSDN Freedom Roadshow in Scranton, PA today, you are missed a good show. Here’s what happened: David Solivan – David presented a talk called UI, UX, U confused? The purpose was to show the various options we have and to explain when one option may be better than another by stepping through the design process. There’s a URL he had mentioned during his talk that will show your best options. Check it out at http://tinyurl.com/59vk7b. Lindsay Rutter started off by talking about the PDC 08. She mentioned that all should come out and attend the … Continue reading Summary of the MSDN Freedom Roadshow
I was looking for a quick and easy solution to export data from SQL into an Excel format from within my ASP.NET application. I came across a great video posted by Beth Massi on the asp.net website (Video #7 at the bottom at http://www.asp.net/learn/linq-videos/). Beth steps through creating the LINQ to XML and how you can populate your Excel document. When I used this in an ASP.NET application, I added the XML declaration to the Response.Write so that Excel could understand the document. In ASP.NET, the XMLDocument type has a tendency to drop the XML declaration when writing out the … Continue reading Use LINQ to XML to Generate Excel Documents
All day I was stumped on why there wasn’t a simple way to grab the first object in a sequence other than using: .Take(1).Single Then I discovered the keyword First. I’m still a little puzzled as to why .Single would throw an exception if more than a single element would be returned. I can’t really see a practical use for it unless you wanted to force only 1 object being returned.
The next .NET Valley User Group event will be on June 18th at Scranton University in Scranton, Pennsylvania. There will be two talks that evening. The first will begin at 6pm and will be presented by Michael Murphy. Michael will talk about the ins and outs of Microsoft Small Business Server 2008. The second talk will begin at 7:15pm or so and will be presented by yours truly. I will be talking about LINQ to SQL. To register for the event, please visit http://dotnetvalley.com/events/eventdetails.aspx?eventid=59.
I was running into an issue where one of my webmethods was taking a large amount of time to return a small set (5-10 objects). I was using LINQ to SQL. I noticed that the LINQ to SQL query was returning all of the rows. After looking into the table a bit further, I noticed that the table included some columns with a larger type (old text column, image column, etc). So, I decided to modify my select to contain just the columns I needed. It improved my response time from roughly 8 seconds to 250 milliseconds. Here’s a sample … Continue reading Performance Tip: Return Only Necessary Columns Using LINQ
I ran into an issue earlier when trying to return an entity class through a web service for use in an AJAX page. After some quick research, I came across a post by Darren Neimke that referenced Rick Strahl’s post about LINQ to SQL and Serialization. For me, performing the first work-around and setting the relationship to ‘Friend’ worked. Thanks Rick and Darren!
LINQ views the Image type in SQL Server as Binary. So, there are a few options that we have. We can either (a) modify our LINQ to SQL class and change the property to Byte() instead of Binary or we can (b) convert the Binary to an array. To do the latter, you can use a lambda expression to obtain the image you are looking for and grabbing just the image. Here’s an example: MySqlContext.Photos.Single(Function(p) p.PhotoID = PhotoID).OriginalBytes.ToArray The above assumes that we have a table called Photos that contains a column called PhotoID. We’ll filter the PhotoID (p.PhotoID) based … Continue reading Retrieving SQL Type Image Using LINQ
I’ve recently discovered that LINQ and VB can be confusing. I was attempting to pull the top 10 rows of a table where the column started with ‘W’. You’d think after I typed that, I’d figure out the solution. That’s not the case. Instead, I struggled. Here’s what I originally came up with: Dim q = From t In db.Employees Where t.LastName Like prefixText & "%" Select t.LastName Take count Little did I realize that the Like operator in my query was the VB Like operator. So, I had to modify my lambda expression to this: Dim q = From … Continue reading Using "Like" in LINQ to SQL