Category Archives: .NET Framework

Automatically log errors with Elmah in Script0Service-WebService calls

If you’ve used Elmah logging in the past then you know it’s a very useful and easy to set up tool in your web applications.  However, when we encounter errors in web services we sometimes do not get the desired logging into the xml file or database, depending on how you have Elmah configured.  This [...]

Posted in .NET Framework | Tagged , | Leave a comment

Calling an ASP.Net web service using jQuery and JSON.

Let’s say you have a webpage where you need to call a service but cannot perform a post back.  Recently I was on a client engagement where we needed to improve page performance by dynamically loading a navigation tree with a potential for several thousand links.  We implemented a solution that would load each branch [...]

Also posted in Ajax, Enterprise .NET, JavaScript, jQuery | Tagged , , , , | Leave a comment

Creating a Helpful Extension Method for Visibility in XAML

In this post, I’ll show you how to create an extension method for the bool class that will simplify your .NET code in XAML-based apps (either WPF or Silverlight). In particular, this extension method addresses the fact that the Visibility property of UI controls in XAML is not a Boolean (true/false) value (as has traditionally [...]

Also posted in User Experience Design | Tagged , , , | Leave a comment

Overview of Simple Parallel Programming with .NET 4.0

Today’s modern day computers contain multi-core hardware capable of performing multiple tasks simultaneously, also known as parallel processing. Prior to .Net 4.0 the norm was to use synchronous operations to perform multi-threading. Although some level of synchronization logic is needed for data that is shared, the simple .NET 4.0 multi-threading technique presented in this article [...]

Also posted in Enterprise .NET | Leave a comment

A Look at Optional Parameters, Named Parameters and Permanent Redirect in .NET 4.0

While getting acquainted with VS 2010 and .NET 4.0, I’ve come across some improvements that that I’ll be sharing in this blog. Three features in particular are Optional Parameters, Named Parameters and Permanent Redirect.
Before .NET 4.0 one would have to overload methods if they wanted the ability to implement optional parameters. With this latest version [...]

Also posted in Enterprise .NET | Leave a comment

Changing SharePoint Default ASP.NET compiler to use ASP.NET 3.5

Overview
While SharePoint 2010 supports .NET 3.5, it uses the .NET 2.0 compiler by default for ASP.NET pages.  If you write any UserControls or consume any DLLs in your hosted ASPX pages that utilizes .NET 3.5 features such as the var keyword, extension methods, and LINQ, you’ll get compilation error messages when attempting to access those [...]

Also posted in SharePoint, SharePoint 2010, SharePoint Foundation, SharePoint Server | Tagged , , | 1 Comment

Using SqlFileStream with C# to Access SQL Server FILESTREAM Data

FILESTREAM is a powerful feature in SQL Server that stores varbinary(max) column data (BLOBs) in the file system (where BLOBs belongs) rather than in the database’s structured file groups (where BLOBs kill performance). This feature was first introduced in SQL Server 2008, and is now being expanded with the new FileTable feature coming in SQL [...]

Also posted in SQL Server | Tagged , , | 4 Comments

Three .NET Best Practices to Keep in Mind

Practice #1: Catch Exceptions at the Highest Possible Level (Tier)
In general, exceptions should be bubbled up to the highest possible level to be caught and processed.  For example, in our project, a search goes through the following logical tiers:
UI -> Services -> Data/SharePoint/Refinement -> Web Services
There are quite a few instances where we’re catching exceptions [...]

Also posted in General | Tagged , | Leave a comment

Slides and Code from NYC (Winter) Code Camp 2011–(How to) Put your Code First with Entity Framework

I would like to thank everyone for attending my presentation this Saturday at the NYC (Winter) Code Camp! I really enjoyed the high level of interest and participation from the attendees. Unfortunately, we only had 75 minutes to talk about Entity Framework and EF Code First but thankfully we have the internet!
Thanks to all [...]

Also posted in Presentations, User Groups | Tagged , , , , , , , , , | 1 Comment

.NET File Compression in Memory

File compression is nothing new to .NET.  However, in many solutions it requires the developer to establish a file folder which they will write the compressed file to and later read from.
This solution cannot work if you want to compress and use the file in memory without writing to disk.  An example of this [...]

Also posted in Enterprise .NET, User Groups | Tagged , , , | Leave a comment