Tag | LINQ Posts

I’ve been looking through the temp directories on my production machines and had realized some overlooked design points in a number of programs; namely the deletion of certain temp files. One situation that particularly caught my attention was some email attachments that should have been deleted. Even though the code was actively calling File.Delete() on some email attachments, they were not being deleted. An error log showed the program was throwing an exception when attempting to delete the files. ...
Giovanni Bassi published the original NuGet package for LINQ to Twitter (L2T), which I'm appreciative of. Since then, I have yet to do a release myself, but that is changing now. The current version of LINQ to Twitter is stable enough for a release, so the time is right. I think there are a few aspects of a LINQ to Twitter NuGet package that aren't as simple as point at a project and your done, so I'll document my process here in case anyone else is interested. Getting Started I had played around ...
At http://peterkellner.net/200... there is a very useful article by my fellow MVP Peter Kellner. This shows that ADO.NET is very much faster than LINQ to SQL unless the latter is compiled. Whilst there may be some cases where Linq to SQL offers genuine benefits, however we should proceed with caution in using Linq unless it a some single use form of query. I suggest after reading Peter's post you leave a note of appreciation for ...
What’s the problem? Given a DB table with an Identity key in SQL Server, that field could not be repeated. Well, if you delete a row, the value would be lost. We are trying to reuse these values. Solution LINQ is something that I love, by that I will use it to solve the problem. To sumup the post, we are going to use a list of integer that will replace our entityset, with the following keys: 1,2,3,5,6,7,9,10,11,15. Well, how to get a jump in the list: 1: var query = from n in listado 2: where (n ...
One thing that’s really got me pumped about the Mango OS update is the inclusion of SQL Compact baked right in. We don’t need to include extra assemblies to get database functionality for our apps, as SQL Compact is a native component in Mango! Before we get all excited thinking we’ll have a full on visual designer experience when developing our apps, realize that this is still an isolate storage based data file that you’ll be using LINQ to SQL to access. There’s no visual designer (yet), which means ...
After reading DLinq (Linq to SQL) Performance and in particular Part 4 I had a few questions. If CompiledQuery.Compile gives so much benefits, why not to do it for all Linq To Sql queries? Is any essential disadvantages of compiling all select queries? What are conditions, when compiling makes whose performance, for how much percentage? World be good to have default on application config level or on DBML level to specify are all select queries to be compiled? And the same questions about Entity Framework ...
This week is a busy week for me. First of all I’m giving another presentation on a LINQ/Lambda primer for the rest of the developers in my company. Of Lambdas and LINQ View more presentations from BlackRabbitCoder Then this Saturday the 25th of June I’ll be reprising my Little Wonders presentation for the Kansas City Developers Camp. If you are in the area I highly recommend attending and seeing the other great presentations as well. Their link is here. Little Wonders View more presentations from ...
I was at the Jazoon 2011 in Zurich (Switzerland). It was a really cool event and it had many top notch speaker not only from the Microsoft universe. One of the most interesting talks was from Don Syme with the title: F# Today/F# Tomorrow. He did show how to use F# scripting to browse through open databases/, OData Web Services, Sharepoint, …interactively. It looked really easy with the help of F# Type Providers which is the next big language feature in a future F# version. The object returned by ...
I have seen the rx demos by Bart De Smet and was blown away by the potential that I think they hold – however I just haven’t had time up till now to have a look at them in any depth. Today I finally set some time aside and got a 10 000 foot view of them. So my plan is for the next few days to develop an application in WPF that makes use of reactive extensions as a dummy project… Today I just wanted to get the basics working, and after going through an very good lab on rx was able to get a very basic ...
In this Issue: Vikram Pendse(-2-), Christian Schormann, Pete Brown, Kunal Chowdhury, Andrea Boschin, SLMPerf, WindowsPhoneGeek, Jesse Liberty(-2-), and Michael Washington. Above the Fold: Silverlight: "Silverlight 5: Vector and Bitmap Printing for Reports and more" Pete Brown WP7: "New SketchFlow Template for WP7" Christian Schormann LightSwitch: "Integrating Visual Studio LightSwitch Application Into An Existing Website using IFrames" Michael Washington Shoutouts: Laurent Duveau presented on LightSwitch ...
Our database has a few lookup tables that uses similar approach to implemented by .Net Framework for localized resources: At run time, ASP.NET uses the resource file that is the best match for the setting of the CurrentUICulture property. If there is no match for the current UI culture, ASP.NET uses resource fallback. It starts by searching for resources for a specific culture. If those are not available, it searches for the resources for a neutral culture. If these are not found, ASP.NET loads the ...
One of of my colleagues wrote a LINQ query similar to the following: var q=from i in keys select GetTuplesOrPossibleNull(i) into kvp orderby kvp.Item2 select kvp; I’ve noticed, that for some data it throws null exception on kvp.Item2 in orderby statement. It was found that calling function sometimes return null instead of expected key-value pair. I thought where I should insert check for null and my first idea was to add check in where statement before select function call, something like the following ...
In this Issue: Rudi Grobler, Roy Dallal, Chris Rouw, Sean Nolan, Peter Kuhn, WindowsPhoneGeek(-2-), Jesse Liberty(-2-), Mike Taulty, Paul Sheriff, Xpert360, and Vikram Pendse. Above the Fold: Silverlight: "Storing Files in SQL Server using WCF RIA Services and Silverlight – Part 1" Chris Rouw WP7: "XNA for Silverlight developers: Part 12 - Mango (1)" Peter Kuhn From SilverlightCream.com: Slide-out keyboard support on Windows Phone Rudi Grobler has a quick post up discussing the slide-out keyboard ...

Here's a blog post by DataSprings on how to use LINQ to Twitter: http://bit.ly/jjmLZY.  It demonstrates how to authenticate with OAuth and how to use several of the APIs.

Joe

Media Type Formatters in the WCF Web API provide a way for the consumer of your service to not only specify the format they want for their response, but also specify the format they are using on their request. Typically the desired response format is specified in the “Accept” request header and the request body format is specified in the “Content-Type” request header. Media types are central to building any RESTful service. Two of the most common media types are “application/xml” and “application/json”. ...
As promised, here is a link to all of the applications from my session at CodeStock 2011: Entity Framework Profiler Studio Styles Reflector Telerik JustDecompile Beta dotfuscator CodePaste.NET Silverlight Spy WP7 Desktop Marketplace LINQPad Snippet Manager Browser Shots Snagit 10 7-Zip File Manager Code Converter CPU-Z Notepad2 SSDlife Free Regular Expression Library DLL-files.com Microsoft Web Platform Installer Visual Studio Gallery Search Everything Fiddler2 Paint.NET Microsoft Expression Blend ...
Once again, in this series of posts I look at the parts of the .NET Framework that may seem trivial, but can help improve your code by making it easier to write and maintain. The index of all my past little wonders post can be found here. On this post I will finish examining the System.Linq methods in the static class Enumerable by examining two extension methods Count() and DefaultIfEmpty(), and one static method Empty(). The Empty() static method How many times have you had to return an empty collection ...
In this Issue: Kunal Chowdhury, Roy Dallal, Jim Wightman, Kevin Hoffman, Levente Mihály, Peter Kuhn(-2-, -3-), René Schulte, WindowsPhoneGeek, Jesse Liberty(-2-), John Papa. Above the Fold: Silverlight: "Reactive Extensions–FromAsync" Jesse Liberty WP7: "Windows Phone 7 Mango - Sockets" Peter Kuhn Shoutouts: Kunal Chowdhury has a list up of all the Windows Phone 7.1 (Mango) Features From SilverlightCream.com: Windows Phone 7 Jump Start with Mango - 1 - Creating a Hello World Application Kunal Chowdhury ...
In this Issue: Alex van Beek, René Schulte(-2-), Peter Kuhn, Kunal Chowdhury(-2-, -3-), Alex Golesh(-2-, -3-, -4-), WindowsPhoneGeek, Jesse Liberty, Nigel Sampson, Jeremy Likness, and Paul Sheriff. Above the Fold: Silverlight: "Entity Framework 4.1 Code First, Silverlight, and Shared Models with REST+JSON" Jeremy Likness WP7: "Windows Phone Mango–What’s New? (“Silverlight/XNA Interoperability” - Part 7 of 8)" Alex Golesh LINQ: "LINQ Deferred Execution–Oops!" Jesse Liberty Shoutouts: My friends at ...
Looks like bloggers figured out I'd post the submittals first, because today I got hammered with posts. In this 2nd in a row Submittal-only Issue: Alex Golesh(-2-, -3-, -4-, -5-), René Schulte, Alex van Beek, Kunal Chowdhury(-2-), Rudi Grobler. Above the Fold: Silverlight: "Silverlight 5 Multiple Window Support" Kunal Chowdhury WP7: "Augmented Mango - SLARToolkit for Windows Phone" René Schulte WP7: "Windows Phone Mango–What’s New? (“New Sensors & Tooling Enhancements” - Part 3 of 8)" Alex Golesh ...
“Design Patterns 100? is a prerequisite for .NET Developers. (Part 5 – Excerpts from July 2010 – PhillyNJ.NET Presentation) Continuing our discussion from Part-4 we ask. What are the “Gang of Four” (GoF) Behavioral Patterns and where can we find them in the .NET Framework? Chain of Responsibility Pattern – A way of passing a request between a chain of objects Command Pattern – Encapsulate a command request as an object Interpreter Pattern – A way to include language elements in a program Iterator ...
I was working on a MVC3 project with jqGrid using JSON. The data was created using EF4 Code First. Took me a while to hook up the grid and actually having it post back to the server to retrieve the JSON. I was having issues with my int ID column not formatting to JSON. LINQ to Entities does not recognize the method 'System.String ToString()' method, and this method cannot be translated into a store expression. StackOverflow had some responses to use SqlFunctions.StringConvert(... ...
Here are the updated links for quick reference: Windows Phone SDK Beta Download Center: http://go.microsoft.com/?li... Go live license– http://go.microsoft.com/?li... WPDT 7.1 Documentation Windows Phone Developer Tools 7.1 Release Notes: http://go.microsoft.com/fwl... What’s New in Windows Phone Developer Tools: http://go.microsoft.com/fwl... Code Samples for Windows Phone: http://go.microsoft.com/fwl... App Hub Links Announcement: http://create.msdn.com/en-U... ...
Materials for the PHILLNJ.NET Presentation – August 24, 2010 On August 24, 2010 I demonstrated the “Repository Pattern” which is a Enterprise Architecture Design Pattern and the foundation of Domain Driven Design (DDD) which is primary in loose coupling your applications design. At this presentation I demonstrated the use of the “Repository Pattern” combined with other subjects such as Unit Testing, Custom Mocking with LINQ & Generics. I also gave out a limited number of CD with the code and ...
Its been a while since I blogged. Its been hard balancing blogging time, work and many other activities. Most my days and even evenings have been cluttered with a number of tasks ranging from mundial to critical. There is some which have been most interesting include very nice lessons I took from from some of the people I respect in the industry. I will try and highlight some of the things I did in below. 1) The DataObjects.NET contribution programme. From February this year I quickly responded to ...
This is a quick presentation I threw together for a group of developers who requested a quick primer on using lambda expressions and the more common LINQ extension methods. It seemed like a good general knowledge presentation so I decided to upload it to slideshare and reference it here as well. This is not meant to be a comprehensive discussion of everything that lambda expressions and LINQ have to offer, but is just sort of a very basic introduction to help those less familiar with reading and ...
I've created IsSubsetOf List extension based on discussion at http://stackoverflow.com/qu... /// <summary> /// Determines whether a System.Collections.Generic.... object is a subset of the specified collection. /// http://stackoverflow.com/qu... /// </summary> /// <param name="list"></param> /// <param name="listToFind"></p... ...
In this Issue: Morten Nielsen, Kunal Chowdhury, John Papa, Jesse Liberty, Mike Taulty(-2-), and Pete Brown. Above the Fold: Silverlight: "Custom Cursors in Silverlight" Morten Nielsen WP7: "Coming in Mango–Sql Server CE" Jesse Liberty Silverlight 5 Beta: "Silverlight 5: Using the SoundEffect Class for Low-Latency Sound (and play WAV files in Silverlight)" Pete Brown Shoutouts: Khawar Yunus sent me this link to his app... I'm not going to tell you to make a login, but I did.. and the app is a pretty ...
Once again, in this series of posts I look at the parts of the .NET Framework that may seem trivial, but can help improve your code by making it easier to write and maintain. The index of all my past little wonders post can be found here. Today I’m going to look at 5 different ways of combining two sequences together using LINQ extension methods. For the purposes of this discussion, I will split these 5 methods into homogeneous and heterogeneous methods (for lack of better terms). “Homogeneous” combinations ...
Last, I needed a function to add paging. The first problem I had, was how to this. A couple of seconds later, I allready had a solution to this problem: Linq Skip and take will do the trick. list<t>.Skip(_howMany... This won't crash if you pass one of both statements. It will just return the result. source.Skip(startRowIndex).... I've created an extension method to use this function. VB Module LinqHelpers <System.Runtime.Compiler... ...
Let’s focus on Exam 70-516 this time. This exam is TS: Accessing Data with Microsoft .NET Framework 4. Additional Resources: http://msdn.microsoft.com/e... The exam objectives are: Modeling Data Map entities and relationships by using the Entity Data Model http://msdn.microsoft.com/e... http://msdn.microsoft.com/e... http://msdn.microsoft.com/e... Map entities and relationships by using LINQ to SQL http://msdn.microsoft.com/e... ...
Once again, in this series of posts I look at the parts of the .NET Framework that may seem trivial, but can help improve your code by making it easier to write and maintain. Today we are going to examine the LINQ set operations that are part of the IEnumerable<T> extension methods. Now, most of the time when people think of set operations they think of the math or logic classes they are usually taught in, but really these LINQ methods have a much larger appeal and applicability than just math ...
I just finished delivering 4 sessions for www.sswug.org at the end of April 2011. Above is a screenshot that was taken inside of the studio. Now, I am going to do a webinar on Silverlight 5 then head to Knoxville, TN and finally Chattanooga, TN. Keep reading for details on the events: SilverlightShow.net Webinar on “Getting started with the Silverlight 5 Beta.” Wed, May 11th, 10 am PST (check your local time) Register for this webinar This webinar is designed for people who want to quickly understand ...
At http://json.codeplex.com there is an excellent open source project for accessing JSON data from Dot Net. The home page states: Features -Flexible JSON serializer to convert .NET objects to JSON and back again -LINQ to JSON for reading and writing JSON -Writes indented, easy to read JSON -Convert JSON to and from XML -Supports Silverlight and Windows Phone The JSON serializer is a good choice when the JSON you are reading or writing maps closely to a .NET class. The serializer automatically reads ...
<Updated 2011-5-1: slides and code from SPSSTL linked below (or click here) and sessions for SPSMI added> <Updated 2011-5-15: slides and code from SPSMI linked below (or click here)> April 30th, 2011 I’ll be presenting at SharePoint Saturday St. Louis. My presentation is “The Expanding Developer Toolbox for SharePoint 2010” which covers many of the new tools and functionality available to developers. This session is fairly demo heavy but stays more on the “overview” side rather than deep ...
Once again, in this series of posts I look at the parts of the .NET Framework that may seem trivial, but can help improve your code by making it easier to write and maintain. Most of my time this week has been spent finishing the current iteration at work and updating a presentation for the Springfield DNUG, so today’s post will be a bit on the lighter side, but I wanted to continue my post series so I thought it would be a good time to quickly mention the ElementAt() and Last() LINQ extension methods. ...
Sometimes, the way that LINQ to Twitter materializes queries into entities isn’t immediately clear. It’s easy to get confused until you see the patterns or make a correlation between the Twitter API results and their representations as LINQ to Twitter entities. In this post, I’ll explain some of the logic behind the design of LINQ to Twitter entities and demonstrate an example of one of the more oddly designed entity types, Search. Note: They'll be talking about MVC3 during multiple sessions at Tech-Ed. ...
The list provided below is my “Best-Of” FREE Frameworks, Tools and Controls for Windows Phone 7. I have used everything listed below in an my WP7 applications. Most of them are in the marketplace at this point and some are still in development. Let’s get started. If you are developing WP7 Applications, this is one that you have probably heard of already. It is Microsoft’s official set of controls that comes complete with full source code of course. Project Description: Welcome to the Silverlight ...
In this Issue: Michael Washington, Morten Nielsen, John Garland, Bil Simser, Adam Nathan, András Velvárt, WindowsPhoneGeek(-2-), Jesse Liberty(-2-), Martin Krüger, Damon Payne, and Xianzhong Zhu. Above the Fold: Silverlight: "Using ICustomTypeProvider in Silverlight 5" Damon Payne WP7: "Hardware Back Button + Marketplace Certification" Adam Nathan Lightswitch: "Deploy Your LightSwitch Application As A DotNetNuke Module" Michael Washington From SilverlightCream.com: Deploy Your LightSwitch Application ...
Once again, in this series of posts I look at the parts of the .NET Framework that may seem trivial, but can really help improve your code by making it easier to write and maintain. Today we’re going to look at two more handy LINQ extension methods: the Any() and All() methods. These methods can help you examine an enumerable collection to determine if any, or all, of the items in the collection meet some logical condition. Any() – Checks for at least one match The Any() method is a LINQ extension ...
One of the greatest benefits I’ve found in simple web output in ASP.NET is the GridView. I regularly use it to display data from objects or databases where the output can simply be shown in a grid form (similar to instances where I would deliver a read-only spreadsheet). I attach the GridView to the <asp:PlaceHolder /> inside of a <form /> on the aspx page: A simple, bulk method of getting the data into the GridView is with the GridView.DataSource property. A GridView.DataSource must ...
The application I'm currently working on performs user authorization using authorization objects injected into Service Layer methods using Unity Interface Interception. For a simplified example, the CustomerService Service Layer object implements ICustomerService: public interface ICustomerService { void UpdateCustomer(int customerId, string name); } ...and has an authorization object injected into UpdateCustomer() method calls which checks that the user currently assigned to the thread is allowed ...
April 30th, 2011 I’ll be presenting at SharePoint Saturday St. Louis. My presentation is “The Expanding Developer Toolbox for SharePoint 2010” which covers many of the new tools and functionality available to developers. This session is fairly demo heavy but stays more on the “overview” side rather than deep dive. I’m excited to visit St. Louis again as I have a number of friends who live there and I’ve heard the SharePoint community is in full swing. Click here for registration information. May ...

A list of some shortcus and new features to VS 2010 and C# 4.0:

Read more at http://blog.danskingdom.com/some-visual-studio-2010-shortcuts-and-c-4-0-cool-stuff/

Once again, in this series of posts I look at the parts of the .NET Framework that may seem trivial, but can really help improve your code by making it easier to write and maintain. Today we're going to look at two LINQ extension methods that are both very similar and yet very different. Logically, First() and Single() serve similar purposes, but there is a subtle difference between these two that if you aren't expecting it may give you very different behaviors. First() - Retrieves the first occurrence ...
As I discussed in my last post, we created a TimeSpinner control based on the Extended WPF Toolkit’s ButtonSpinner. Now, the toolkit has a DateTimeUpDown control that will display a date or time and allow the user to click the spinners for each time part, but I needed a little more. I needed the raw text to be editable and I wanted the spinners to just modify the minutes portion. I also wanted to have special parsing based on the number of characters entered. 4 chars:Parse as military time. 3 chars: ...
I am very excited to help share this news with you today! I feel as excited today as I was when Windows Phone 7 developer story was revealed at MIX10 last year. I see so many more application scenarios with the new tools and features in Windows Phone 7. There has been a few announcements made at MIX11 – let me recap some of what I find important. There was not a disclosure or showing of any new end-user features. There is a commitment to delivering the next update later this year as a free updates ...
Well, another Philly Code Camp has come and gone, and it was a great time. I made it a one-day trip, which I think I'm getting too old to keep doing. Left the house at 4 AM from Pittsburgh, made it to Philly by 8:15 AM; I left around 4 PM and got home by 9 PM (no thanks to my TomTom, which took me on a scenic tour of old town Fort Washington). I was expecting a nice and relaxing day at Philly Code Camp where I had one talk (A Beginner's Guide to LINQ) at 2 PM; but I got an email from Marc Ziss asking ...
This post is from a very good friend of mine, Billy Hollis. He’s got some interesting food for thought and I think you’ll enjoy his perspective! For over 15 years now, our industry has been struggling with a crucial tradeoff. We can get broad reach via standards, or we can get the best possible user experience with applications that take advantage of particular devices or platforms. It's a stereotype that people in software development tend to be code and technology centric and not user centric. ...
Last time I posted something regarding Converting IP Addresses to Decimal and Looping an IP Address Range The next step is to do something with those remote IP Addresses. The first thing that we can play with is to get some information from a remote host using Netbios Name Service. Some of the information that we can get using the class below are 1. Mac Address 2. Netbios Name (Computer Name) 3. Netbios Group (Workgroup name, Domain Name) 4. Netbios Username Below is the initial helper class I coded ...