Practicle.NET

Working with JSON in SQL Queries

Tue, 19 Sep 2017 13:15:00 GMT

SQL Server 2016 lets you treat JSON objects like rows in a table, allowing you to use data from AJAX queries in joins, updates and any other SQL statement you can think of.

Returning Simple Strings from Action Methods

Tue, 12 Sep 2017 13:40:00 GMT

When you want to return a string result -- either as text, HTML or XML -- then a ContentResult object gives you the right balance of simplicity and control.

The Future of Programming

Tue, 05 Sep 2017 19:52:00 GMT

If you’ve been programming long enough, then you know that the "right way to do things" keeps changing. Here’s why, a description of where we are now and a guess about where we’re going.

Quick Tip: Read the Inner Exception!

Thu, 31 Aug 2017 13:31:00 GMT

That's often where the real problem is.

LocalDB: The Database Without a Connection String

Tue, 29 Aug 2017 21:29:00 GMT

If you just want to get going with a code-first database, you don't even need to define a connection string -- just write your objects.

Exploiting the Validation Tools in ASP.NET MVC

Mon, 28 Aug 2017 19:30:00 GMT

Your users will make mistakes ... but it would be a mistake to treat all their errors the same way. You can get more out of ASP.NET MVC's validation infrastructure just by paying attention to how you name your errors.

Returning JSON from SQL Server Queries

Thu, 24 Aug 2017 12:39:00 GMT

With JSON now the default format for moving data between clients and servers, SQL Server adds JSON support to make it easier to get your data out of the database and down to the client.

Improving Feedback When Editing HTML

Fri, 07 Jul 2017 17:51:00 GMT

Get Visual Studio to be more helpful when you're working with HTML.

Send the Right Error Information with HttpException

Fri, 30 Jun 2017 21:31:00 GMT

When something goes wrong with your Web Service the decent thing to do is to return your errors in a variety of ways.

AJAX Without JavaScript

Thu, 29 Jun 2017 02:31:00 GMT

You like the idea of an AJAX application, but would rather not write the JavaScript yourself. You're in luck: ASP.NET MVC provides two tools that write the client-side code for you. And these tools even make sense if you’re comfortable with writing your own JavaScript.

Accept HTML and Script from Your Web Pages

Thu, 22 Jun 2017 21:07:00 GMT

Sensibly, ASP.NET MVC 5 prevents users from entering HTML or Script tags into your page's textboxes, protecting you from a wide variety of hacks. However, for those rare occasions when you do need to let the user enter tags, here's how to do it.

Calling Web Services with HttpWebRequest, WebClient and HttpClient

Tue, 13 Jun 2017 17:27:00 GMT

The .NET Framework gives you three different ways to call a Web Service. However, depending on your scenario, the latest and greatest object isn’t necessarily your best choice.

Add a Multi-Select ListBox or DropDownList to Your ASP.NET MVC View

Fri, 09 Jun 2017 17:02:00 GMT

Peter doesn't like them, but that doesn't mean you have to hate 'em, too -- here's how to add a listbox or dropdown list to your View that lets users select multiple items.

Reduce Overhead When Retrieving Objects with Entity Framework

Wed, 07 Jun 2017 16:34:00 GMT

If you're only retrieving an object so that you can read its data, you can reduce your costs by turning off Entity Framework tracking. Which is exactly what you want to do in ASP.NET MVC, as long as you're careful.

Leverage Global Filters and the HandleError Attribute in ASP.NET MVC Apps

Fri, 02 Jun 2017 21:00:00 GMT

Here's how to combine adding HandleError attributes to your ASP.NET MVC application both through Global Filters and adding them directly to your Action methods.

How I Approached Gaining Microsoft Certification

Tue, 30 May 2017 16:00:00 GMT

If you’re thinking about pursuing a Microsoft Certification, here’s how and why Peter went through the certification process for the second time, including his feedback on some of the resources available to you.

Exploiting Partial and RenderPartial in ASP.NET MVC

Fri, 26 May 2017 20:41:00 GMT

If you're wondering what the difference is between the HtmlHelper Partial and RenderPartial methods, then here's why Peter, at least, uses Partial.

Working with Exceptions Before the Error Handler Does

Mon, 22 May 2017 18:00:00 GMT

Normally, you don’t care about first-chance exceptions -- it's only when something becomes a second-chance exception that you start to pay attention. But when you do care about all the exceptions, here’s how to work with them both in Visual Studio and in your code.

Speed Up Your ASP.NET MVC Application with Doughnut Hole Caching

Fri, 12 May 2017 01:00:00 GMT

The OutputCache attribute is a great way to improve both response time and scaleability, except there are many times when you can’t use it. Here’s how to leverage the HtmlHelper Action method to handle those exceptions.

Turn Off Caching at the Browser

Mon, 08 May 2017 21:10:00 GMT

You can force users to always get the most recent version of your ASP.NET Web page by using the last tool you'd expect to handle this: The OutputCache attribute.

The Best Option for Selecting Related LINQ Objects

Fri, 28 Apr 2017 22:48:00 GMT

Here's the best performing option when you're retrieving the objects at the end of an entity class's navigation property, either when you only want some of the objects or when you only want them some of the time.

Leveraging Contract Technology for Simpler Applications

Tue, 25 Apr 2017 07:00:00 GMT

If you haven’t used the .NET Framework Contract tools to help guarantee code quality, it’s worthwhile to consider integrating them into your work. If you figured that Contracts were all hype, it may be time to see how they could be genuinely useful.

Working with the Properties Window in Visual Studio's Categories View

Mon, 24 Apr 2017 16:58:00 GMT

If you prefer to keep your Properties Window in Categories View, then here's some shortcuts you might find valuable.

It’s Time to Reconsider Using Contracts

Mon, 17 Apr 2017 17:00:00 GMT

Coding by Contract was once the future of programming. It isn’t as popular now as it was even five years ago, at least in the .NET Framework community. But that doesn’t mean you can’t find the related tools useful.

Grouping in LINQ with Methods

Fri, 14 Apr 2017 07:00:00 GMT

Peter follows up -- yet again – on a column on how to group results with LINQ using the SQL-like syntax with the same solution using the method-based syntax. And, no, you're not seeing double.