Archives
-
Event Centric: super-charge your model with domain events to enable business intelligence
I’ve shown in my previous post how interesting domain events can be mined using the Reactive Extensions for .NET. Now we need to raise those events when things happen to our domain. The typical way you’d publish events from your domain is simply adding .NET events. Say we have a Patient class, with a method Admit that causes the patient to be in the hospital and tracks the date when he was admitted:
-
Event Centric: finding key business value by leveraging domain events and reactive extensions
Reactive Extensions (Rx) is one of the coolest additions to .NET ever. However, they have been largely ignored by the mainstream, in a significant part because (IMO) it’s seen as a UI technique, with samples that show how to handle mouse moves, drag & drop and so on. Its focus on asynchronous programming too makes it look like a niche technique that might even be worth skipping over as we wait for C# 5.0 async keyword (see Mike’s blog entry on a possible clarification of where it might fit in the async world).
-
How to make object initializers more useful
Quite often, it's necessary to validate an object state when it's initialized. With constructor arguments, this is easy to do as it can be done at the end or beginning of the constructor code. With object initializers, it's nearly impossible, as there's no way to know programmatically when the object initialization is finished.
-
Cloud-aware music done right: Spotify is the iTunes, Zune, Amazon Cloud Player and Google Music killer
Oh boy, how I’ve been waiting for something like Spotify!!! Just got an account setup (like 10’ ago) and I’m already blown away by it. Everything I’ve always wanted, truly.
-
How to improve string resources usability
(cross-posted from NETFx)
-
How to mock a dynamic object
Someone asked me how to mock a dynamic object with Moq, which might be non-obvious.
-
Making regex authoring easier to read and maintain
I’m spiking ideas on how to make my regular expressions easier to read and maintain for the dev who comes after me (that could be myself in 3 months, meaning I will surely have forgotten everything about how that crazy regex worked).
-
X1 vs X220 side by side specs that matter
Is it just me or the X220 is just plain better in almost all relevant fronts?
-
How to do reflection with a dynamic style
I’m not advocating *private* reflection (invoking private/internal fields, properties and methods), but we all know that there are those corner cases where you just can’t avoid it. And there’s a whole lot of scenarios when there are legitimate uses of reflection itself that can also leverage this very cool dynamic syntax (i.e. invoking generic methods where you don’t know the type at compile-time, etc.). In these cases, your code goes from pristine-looking C# to crappy unreadable reflection code.
-
Building NuGet extensions in 10 minutes, or how to contribute to NETFx
From the documentation:
-
Introducing NETFx, or the end of Common.dll and Helpers.dll
From the project home page:
-
Querying WCF endpoints using Web API
In previous versions of the Web API, you could query your REST endpoints that exposed an IQueryable<T> server-side, kinda “Linq to WCF” as @gblock said. This was immensely useful and an important driver (among others) for me to move away from
AstoriaADO.NET Data Services. That functionality is gone now (vote to get it back!). -
How to easily test WCF Web Api services
Given the many cross-cutting concerns you can cover using the new Web API pipeline, it’s not a bad idea to have a bunch of integration-style tests that cover the actual running service end to end.
-
Using Json.NET for text and binary Json payloads with WCF WebApi
There is an aging post by Christian on how to use the awesome Json.NET library as a default serializer for the new WCF Web Api.
-
How to use Autofac with WCF Web API
The new configuration model in the latest WCF Web APIs allows extending the service instantiation via what is called a resource factory.
-
How to replace default interface property implementation expansion with automatic properties
By default, when you implement an interface in a class, you get the following for properties:
-
Writing inline MSBuild tasks in C# for one-liners
Every now and then, when trying to do something in MSBuild, I hit a roadblock (or maybe just some unintuitive “feature”) and I’m left thinking “gosh, now I have to create a custom MSBuild task for this one-liner that is SO trivial in plain C#!”.
-
DevEnvDir considered harmful
It’s quite common to refer to $(DevEnvDir) in a project, such as to specify the path to a referenced assembly, or to execute a tool on a build event or a target. It’s right there in the UI after all, why not use it?
-
How extension methods ruined unit testing and OOP, and a way forward
You probably know I’m an advocate of a particular way of doing extension methods that I call the “Extension Method Entry Point Pattern”, which makes it easier to mock them.
-
How to design a unit testable domain model with Entity Framework Code First
I got this question a couple times already so I’ll save keystrokes and post here.
-
How to add an MSBuild import to a project on NuGet install
This functionality has been discussed and requested as a feature for a future version of NuGet.
-
How to send URL shortcuts to a specific browser such as Internet Explorer
IE is not my default browser. But still some links have to be sent to it in order for the right thing to happen (i.e. Microsoft Lync invitations, Live Meeting, InfoPath forms, etc.). So far I had the multi-click solution of opening IE, then clicking on a toolbar bookmark.
-
Check your Embed Interop Types flag when doing Visual Studio extensibility work
In case you didn’t notice, VS2010 adds a new property to assembly references in the properties window: Embed Interop Types:
-
How to flash, root and SIM unlock a Galaxy Tab
These instructions worked for me on two AT&T devices, 850/1900 WCDMA (the one that works in Argentina), model SGH-i987 to be precise.
-
How to make all non-virtual members virtual
Using a simple find & replace with a regex in VS2010: