Tag Archives: linq

Converting MHTML to HTML

I recently had a need to convert an MHTML file attachment into HTML text so that it could be used as the body of a notification service email. Initially I was overwhelmed by the nature of MHTML’s encoding and document structure. Eventually I settled on the following relatively compact LINQ statement: The idea is to...… read more

Using LINQ “Contains” to Query WCF Data Services

Working on a client project recently I ran into a problem trying to query my WCF Data Service.  I get a list of counties from an ASP .NET MVC 2 application and need to find the matching members who live within those counties.  The obvious solution would be something like this: But wait! It seems...… read more

LINQ to SQL Extension Methods

LINQ to SQL is a powerful component of .NET, however, I often find myself duplicating the same code across projects. I created the following extension methods to make common operations easier to use. The class adds generic methods for Delete(), Save(), Exists(), and IsAttached(). The IsAttached() method is required to make sure that the data...… read more