Category Archives: Web

ASP.net and other C# web-application stuff

Creating an Instance Without Using Constructors

You can create an instance of a class without calling any of its contructors, via a call to System.Runtime.Serialization.FormatterServices.GetUninitializedObject(typeof(A)). Scary, but useful in certain cases (like creating instances of highly-coupled or hard-to-instantiate classes in tests). Continue reading

Posted in Core .NET, Web, Wndows Forms | Tagged | Leave a comment

Simple Strategies to Boost SQL Server Performance

SQL Server can be a beast on your disk. Two easy ways to help raise performance for high-volume databases: Use a drive other than the Windows partition for the SQL Server DB files, and split the MDF and LDF files onto different drives if possible. Continue reading

Posted in Platform, Tools, Topic, Web | Tagged , | Leave a comment

Storing a String List in App.Config or Web.Config

How can you store a list of strings (or ints, say) into a single appSetting key/value pair? Surprisingly, it’s as easy as using a delimited list (like comma-delimited or semicolon-delimited) and splitting it at runtime. Continue reading

Posted in Core .NET, Silverlight, Web, Wndows Forms, WPF | Tagged , | Leave a comment

Procedure Expects Parameter Which Was Not Supplied

SqlCommand’s Parameters prevent SQL injection attacks. Surprisingly, when passed in a null value, you get the exception: Procedure or function “…” expects parameter ‘@foo’, which was not supplied. Continue reading

Posted in Core .NET, Web, Wndows Forms, WPF | Tagged , , | Leave a comment

Updated Version of Random Number Generators

After several months, I’ve finally updated the normally-distributed random number generator to tolerate negative numbers in its range. Thanks to everybody who complained to get this feature done! Continue reading

Posted in Libraries, Silverlight, Web, Wndows Forms | Tagged | Leave a comment

Configuring NLog for WCF Services

NLog didn’t cooperate for my WCF services (server side). I finally did manage to get it working, with a few extra steps; this post outlines how to configure NLog to work with WCF services. Continue reading

Posted in Libraries, Web | Tagged , , | Leave a comment

SQL Server Indexed Views and View Performance

SQL Server allows you to index views, which caches the results; what’s more, indexed views may automatically be included in queries at SQL Server’s discretion — no application changes required. Wow! Continue reading

Posted in Tools, Web, Wndows Forms | Tagged | Leave a comment

Visual Studio Automatic Version Numbering

Visual Studio (2010+) allows you to specify that it should generate (incremental) build versions for your projects. The syntax is quite simple (for AssemblyInfo.cs), but there are a few caveats to know. Continue reading

Posted in Silverlight, Tools, Web, Wndows Forms, WPF | Tagged , , | Leave a comment

Finding Circular Dependencies in SQL Server

SQL Server doesn’t allow a cycle of foreign keys, nor two or more paths to cascadingly delete rows from a table. Thankfully, there’s a script you can use to detect at least table reference cycles. Continue reading

Posted in Libraries, Web, Wndows Forms, WPF | Tagged , , | 3 Comments

Rails-Style Test Database Creation in ASP.NET MVC

How can you get ASP.NET MVC to create your database on the fly for tests? Well, you can, if you use migrations for your application to build the tables, drop and recreate all the tables prior to running any tests. Continue reading

Posted in Core .NET, Web | Tagged , , | Leave a comment