Practical .NET


Export Your ASP.NET Configuration To Reduce Restarts, Share Settings

You don't have to keep all your configuration settings in your config file. There are even some benefits to exporting sections to separate files.

Returning Raw JSON Data in Web API with Marten

Here's a trick to have Marten automatically deserialize JSON data only when you want it to.

Getting All the Results When Joining with LINQ

When you want to find all the objects that are missing a corresponding object, then you need the LINQ equivalent of an outer join. Here, step by painful step, is how to build that query.

Move from Tab to Tab in the Visual Studio Toolbox Without the Mouse

You don't need to take your hands off the keyboard to move to another tab in the Toolbox.

Working with Enumerated Values in Entity Framework

If you decide on using an Enum with enumerated values in your Entity Framework class, here are the tools you'll need to make it work. But an enumerated value shouldn't be your first choice.

Shortcuts for Defining Anonymous Objects in C# and VB

Here are two ways to save some typing when defining anonymous objects. One only works in Visual Basic, though.

Build Your Own ASP.NET Cache with WeakReferences

You want to keep an object around only as long as you have memory available, do ya? Then you need the WeakReference class.

Enforce Referential Integrity Between Documents in Marten

Marten is PostgreSQL-based, so take advantage of relational features where it makes sense. Here's an example.

Dealing with Complexity with DTOs and Command Objects

Peter starts off with a perfectly good solution to a problem but then complicates the problem . . . and ends up moving to a different design pattern. While on that journey he has some best practices around designing Data Transfer Objects.

Convert .NET Framework Lists into Dictionaries

You probably use ToList to convert your LINQ results into Lists. It's almost as easy to convert any collection into a Dictionary whose items you can retrieve by key.

Chain of Responsibility and Adapting to Change in Complex Apps

As a company's problems continue to become more complicated, your code will become more complicated. Peter shows how refactoring code can lead you to better designs.

Getting to the File You Want in Visual Studio's Editor Window

Peter gets an improved tip from one reader and some more tips from another, all designed to navigate Visual Studio faster.

Providing Multiple Solutions to a Problem

Sometimes life is like playing Whack-a-Mole: You write some code that solves a problem, and then someone comes along and makes the problem harder. Here's how to continuously integrate new solutions without having to rewrite your old solutions (much).

Get Rid of the Old ASPX View Engine

Peter didn't bother doing any performance testing but he believes that this change has just got to speed up your ASP.NET MVC application.

Find Out What Your Entity Framework Query Is Really Doing

You can turn on logging for your Entity Framework code with a single line. Configuring it to write to a file takes only a little bit more effort.

Subscribe on YouTube