Practical .NET


Handling Bad URLs in ASP.NET MVC

If users enter an invalid URL, then ASP.NET MVC will handle the problem by issuing a generic HTTP error. Here's how to give users more support (plus some advice on avoiding the problem altogether).

A Simple and Sophisticated Logging Tool

When things go wrong in production, logging provides a way of going back through an application's history to find out what happened. Here's the simplest possible way to use Peter's favorite third-party logging utility: NLog.

Speed Up Stored Procedures with Table Valued Parameters

Peter revisits an earlier tip on how to use stored procedures to speed up your code. This version makes your stored procedures simpler … though you may have to write a little more code to make the call.

Leveraging Custom ASP.NET MVC Templates to Support Real-World Views

In the real world, you'll often need to display constant and repeating data, a.k.a. Master/Detail pages. Custom templates are the cleanest, simplest way for you to manage them.

Displaying Data Flexibly with Custom View Templates in ASP.NET MVC

You don't always want to display the same data the same way. Here are your options for leveraging custom templates in Views to meet all of your needs -- and the code you need when a template won't do the job.

The Danger of Received Wisdom (or, Stupid Things I've Said)

Peter reviews some of the more spectacularly incorrect things he's told other people and then draws some conclusions.

Geek Talk: Are Strings Value Types or Reference Types?

Some things only matter to the true nerd. So, if you're looking for a genuinely useful article, this isn't it.

What's Fixie and Why Should C# Programmers Care?

It's what unit testing should be. Here's how to use it to test your apps.

Speed Up Your Application with Stored Procedure and Temporary Tables

Stored procedures can speed up your code by reducing trips to your database -- even if you only have one SQL statement to execute. Here's how to speed up your application (and how to simplify your stored procedure code).

Automatic Sorting for Your Collections

The .NET Framework has two collections that will guarantee your items are always sorted whenever you process the collection. Here's how to choose between the two and how to control the sort order (including supporting duplicate entries).

ConventionTests, Part 2: Creating Custom Conventions in ASP.NET

Now that you know how to use them (see Part 1 if you don't), it's time to create custom ones.

Everything You Didn't Know About Shared and Static Members

Peter's convinced you're not using Shared and static members enough, but then he's also convinced that none of you know about all the ways you can use those two keywords.

Retrieve and Update Entity Framework with Dynamic Queries

You don't have to give up on creating dynamic queries just because you're using Entity Framework. Entity SQL and ObjectQuery will let you generate queries at runtime and still let you update your data through Entity Framework.

Keeping Your Next Developer Job

You don't need to worry about keeping your current job -- it will be gone, eventually. What you want to worry about is keeping your next job. That means developing the right skills to the right level for the package you intend to provide to employers.

Creating a Simple Collection Class

Here's the simplest possible code for creating a custom collection class in the Microsoft .NET Framework that includes support for For…Each loops, an indexer method and initializing collections with {…}.

Upcoming Events

.NET Insight

Sign up for our newsletter.

I agree to this site's Privacy Policy.