Setting Window Size With Caliburn Micro

This is something that has actually bugged me for a while. Once I figured it out, it annoyed me that I didn’t figure it out sooner. When displaying a window in Caliburn.Micro, you can set attributes about the Window object when calling it. So, let’s say you want to set the height and width on the window to 600 x 300: First, you would start with something like this: public class ShellViewModel : PropertyChangedBase, IShell { private readonly IWindowManager windowManager; public ShellViewModel() { this.
Read more →

Wiring Up Fluent Validation With WPF

Update I originally wrote this proof of concept about 7 years ago early in my time with WPF. I published it on an earlier iteration of my blog via Github Gist and Wordpress (You can find the gist here). After which point I pretty much forgot out it. I recently came across the Gist and found that it has helped out a surprising number of people. So, it makes sense to me to pull this in to a blog and annotate it a bit better.
Read more →

Getting Started With Hangfire

Putting together this guide for testing out hangfire to fill in some of the gaps I found through creating a greenfield hangfire application. Setting up a database to test with Since I don’t have a SQL Server running that I can just attach to. I’ll have to run through the initial set up of SQL Express Edition Navigate to the website: https://www.microsoft.com/en-us/sql-server/sql-server-downloads Under the “Express” item at the bottom of the fold, hit the button “Download Now >” Run the installer Select “Basic” option Hit the “Accept” button without reading anything because I actually want to get some work done.
Read more →

Activator.CreateInstance Alternatives with Benchmarks

.NET provides multiple ways of generating objects at runtime. Each of these options offer their own trades offs in terms of performance. I will demonstrate that not only are there great performance gains to be had over Activator.CreateInstance(…), but I will also show that there are nuances to how you set up these classes that can dramatically effect performance. Why is this important? While there may be more applications, two examples that I can think of that rely on generating objects at runtime are game development frameworks and IOC (inversion of control) containers.
Read more →

Setting up Autofac with Caliburn Micro v3.2.0 and Autofac v4.8.1

I find myself frequently setting up new projects with Caliburn Micro; however, It isn’t always easy to remember the code to integrate Autofac with the bootstrapper. So, here is the template that I use when creating a new application. public class ClientBootstrapper : BootstrapperBase { private static IContainer Container; public ClientBootstrapper() { this.Initialize(); } protected override void Configure() { var builder = new ContainerBuilder(); builder.RegisterType<WindowManager>() .AsImplementedInterfaces() .SingleInstance(); builder.RegisterType<EventAggregator>() .AsImplementedInterfaces() .SingleInstance(); Container = builder.
Read more →