Simple Injector v4

For the last months we’ve been working on the next major release of Simple Injector, and it is finally here. We have removed legacy methods, simplified working with the library, and fixed many bugs and quirks.

read more...

- filed under .NET General, Dependency injection, Simple Injector - No comments / No trackbacks - §

Abstract Factories are a code smell

When it comes to writing LOB applications, abstract factories are a code smell as they increase the complexity of the consumer instead of reducing it. This article describes why and offers alternatives.

read more...

- filed under .NET General, Architecture, C#, Dependency injection - twelve comments / No trackbacks - §

Dependency-injection anti-pattern: Injecting runtime data into components

Injecting runtime data into your application components is an anti-pattern. Runtime data should flow through the method calls of already constructed object graphs.

read more...

- filed under Dependency injection - five comments / No trackbacks - §

Dependency Injection in Attributes: don’t do it!

A number of common frameworks have promoted the concept of using attributes as a way of implementing AOP. On the surface this seems perfectly acceptable but in reality the maintainability of these options degrades as you add behaviors by injecting dependencies into attributes. The point of this article is “don’t do it!” There are better ways and this article will describe one such alternative.

read more...

- filed under .NET General, ASP.NET, C#, Dependency injection - 25 comments / No trackbacks - §

Dependency Injection anti-pattern: multiple constructors

When Dependency Injection is applied correctly and completely it is important that each type only has one constructor - multiple constructors are redundant, make your DI configuration fragile, and lead to maintainability issues.

read more...

- filed under .NET General, Architecture, C#, Dependency injection - nine comments / No trackbacks - §

Simple Injector 2 – The future is here

Announcing the new major release of Simple Injector. The Simple Injector is an easy-to-use Inversion of Control library for .NET and Silverlight.

read more...

- filed under .NET General, Architecture, Dependency injection, Simple Injector - No comments / No trackbacks - §

Writing Highly Maintainable WCF Services

When it comes to writing maintainable software, there is no alternative to the five core principles of object oriented design. When software is based on these principles, everything becomes significantly easier. When your software is based on these principles, writing a highly maintainable WCF web service on top of that can be done in just a matter of minutes.

read more...

- filed under .NET General, Architecture, C#, Dependency injection - eleven comments / No trackbacks - §

Primitive Dependencies with Simple Injector

This article describes how to extend the Simple Injector with convension based configuration for primitive constructor arguments.

read more...

- filed under .NET General, C#, Dependency injection, Simple Injector - No comments / No trackbacks - §

Returning data from command handlers

This article extends the architectural design of command handlers to allow command handlers to return data.

read more...

- filed under .NET General, Architecture, C#, Dependency injection, O/RM, Simple Injector - 22 comments / No trackbacks - §

Meanwhile... on the query side of my architecture

Command-query separation is a common concept in the software industry. Many architectures separate commands from the rest of the system and send command messages that are processed by command handlers. This same concept of messages and handlers can just as easily be applied to the query side of an architecture. There are not many systems using this technique and this article is an attempt to change that. Two simple interfaces will change the look of your architecture... forever.

read more...

- filed under .NET General, Architecture, Dependency injection - 47 comments / No trackbacks - §

Meanwhile... on the command side of my architecture

This article describes how a single interface can transform the design of your application to be much cleaner, and more flexible than you ever thought possible.

read more...

- filed under .NET General, Architecture, C#, Dependency injection - 60 comments / No trackbacks - §

Adding Covariance and Contravariance to Simple Injector

A few weeks back I read this question on Stackoverflow. The question was about applying covariance / contravariance (or variance for short) to the Autofac dependency injection container. The question triggered me to think about variance support in Simple Injector. I was wondering whether special changes were needed to the core framework to allow this. However, it didn't take me long to realize that enabling variance is actually pretty easy for anyone using the Simple Injector. The prerequisites are a proper application design and .NET 4.0.

read more...

- filed under .NET General, C#, Dependency injection, Simple Injector - three comments / No trackbacks - §

Faking your LINQ Provider part 2: Optimizing performance with fetching strategies

This sequel explains how to write O/RM specific performance optimizations in such a way that the core business logic won’t be affected. This article builds on top of the foundation described in part 1 and uses the Fetching Strategy design pattern to achieve this goal.

read more...

- filed under .NET General, C#, Dependency injection, Entity Framework, LINQ, LINQ to SQL, O/RM, Simple Injector, SQL - No comments / No trackbacks - §

Simple Injector: Working with multiple constructors

Although limited in features, the Simple Injector has simple but flexible way to add features, such as the possibility to work with multiple constructors.

read more...

- filed under .NET General, C#, Dependency injection, Simple Injector - two comments / No trackbacks - §

Faking your LINQ provider part 1

I recently tried to figure out how to write testable code while using LINQ to SQL as my O/RM of choice, without loosing the ability to use LINQ to Expression trees! In this post I describe the design I ender up with.

read more...

- filed under .NET General, ADO.NET, C#, Databases, Dependency injection, Entity Framework, LINQ, LINQ to SQL, O/RM - fifteen comments / No trackbacks - §

Dependency Injection in ASP.NET Web Forms with the Common Service Locator

This article describes how to create and configure a custom PageHandlerFactory class that enables automatic constructor injection for System.Web.UI.Page classes. This keeps your application design clean and allows you to keep the application’s dependency to the IoC library to a minimum.

read more...

- filed under .NET General, C#, Dependency injection, Simple Service Locator - eight comments / No trackbacks - §

Simple Service Locator - The easiest Inversion of Control framework in town

The Simple Service Locator is an easy-to-use Inversion of Control library that is a complete implementation of the Common Service Locator interface. It solely supports code-based configuration and is an ideal starting point for developers unfamiliar with larger IoC / DI libraries

read more...

- filed under .NET General, C#, Dependency injection, Simple Service Locator - eight comments / No trackbacks - §