Category Archives: Web

ASP.net and other C# web-application stuff

Deserializing to Dynamic with RestSharp

You can use JSON.NET to convert any RestSharp service response to a list of dynamic instances; you just need a bit of plumbing code to do it. Continue reading

Posted in Libraries, Silverlight, Web, Wndows Forms, WPF | Tagged , | 1 Comment

Using Enumerations as Bit Flags

You can use enumerations as bit flags. The FlagsAttribute is optional; more importantly, you need to assign powers of 2^n to the enum’s values. Depending on the .NET version, checking can be easy (.HasFlag) or hard (bitwise AND operation) Continue reading

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

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