Category Archives: Libraries

Anything related to .NET libraries–whether Microsoft or third-party.

Consuming RabbitMQ Messages in ASP.NET MVC

You can create an ASP.NET MVC site that consumes RabbitMQ messages with a persistent connection; here’s how (static variables, no using statements). Continue reading

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

How to Subclass .NET Classes from IronPython

To subclass .NET classes in IronPythion, tell the Python engine instance runtime to load the assembly; then, use the fully qualified namespace in your Python code. Continue reading

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

Changing the Login URL from login.aspx on ASP.NET MVC with Forms Authentication

When you enable forms authentication in an ASP.NET MVC5 web application, by default, it redirects unauthenticated requests to ~/login.aspx. You can specify web.config configuration (authentication tag, forms sub-tag, loginUrl property) to change this. Continue reading

Posted in Libraries, Web | Tagged | Leave a comment

Authenticating Against Web API from ASP.NET MVC

In a previous post, we talked about setting up ASP.NET MVC and Web API to accept forms authentication. With this structure in place, your MVC front-end can make Web API calls. The question is, how do you authenticate? What cookies … Continue reading

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

Running FluentMigrator Migrations at Runtime

You can run FluentMigrator migrations at runtime, through code. You need to reference the `FluentMigrator.Runner` package, and with some sample code, you can easily check the current/latest version and update to the latest (or to a specific) version. Continue reading

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

Creating Cross-Platform MonoGame projects

As of MonoGame 3.5, you can create a single project which generates executables for Windows, Linux, and Mac, together. Just create a “MonoGame Cross Platform Desktop Project” solution and you’re ready to go. Continue reading

Posted in Libraries | Tagged , | Leave a comment

Mocking Base Class Methods with Moq

Moq does allow you to mock base class methods, via the use of the Moq.Protected namespace. You can read about it here. Imagine you have the following scenario: class Animal { private int timesTalked = 0; public void Talk() { … Continue reading

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

Converting IronRuby’s MutableString to C#’s String

IronRuby returns an instance of MutableString, which is not easily comparable to C#’s string type. Thankfully, you can call ConvertToString, which returns a vanilla C# string instance. Continue reading

Posted in Libraries | Tagged | Leave a comment

Extending C# Classes in IronRuby

You can extend C# classes in Ruby (via IronRuby) by subclassing them. But you can’t monkey-patch them to add new methods, or override existing methods. Continue reading

Posted in Libraries | Tagged | Leave a comment

From C# To Javascript and Back Again, Via ClearScript

I created a simple Interactive Fiction engine in C# which exposes a few classes and allows users to write their games in Javascript. It’s awesome, honest. I used ClearScript for the back-end, and worked through some type conversion issues. Continue reading

Posted in Libraries, Wndows Forms | Tagged , | 1 Comment