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.
Announcing the new major release of Simple Injector. The Simple Injector is an easy-to-use Inversion of Control library for .NET and Silverlight.
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.
This article describes how to extend the Simple Injector with convension based configuration for primitive constructor arguments.
This article extends the architectural design of command handlers to allow command handlers to return data.
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.
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.
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 the 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.
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.
Although limited in features, the Simple Injector has simple but flexible way to add features, such as the possibility to work with multiple constructors.
The Simple Injector is an easy-to-use Inversion of Control library for .NET and Silverlight. It solely supports code-based configuration and is an ideal starting point for developers unfamiliar with larger IoC / DI libraries.
In this post I again like to consult my Simple Service Locator users, readers of my blog, and followers of the Simple Service Locator CodePlex project, about a change to the library I'm considering.
The Simple Service Locator has a hard dependency on the Common Service Locator. But is this a good design choice? I like to hear your opinion on this.
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.
Roger Alsing wrote an interesting post yesterday about adding support for enums to LINQ queries. It is nice to see what Roger is doing with the .NET 4.0 ExpressionVisitor to change Expression trees that allow this behavior. What I dislike however, is that for this solution you need to reimplement all Queryable extension methods. So I thought about this and found a more pleasant way of intercepting query calls.
The IDataErrorInfo interface is a core part of the .NET framework and both WPF and ASP.NET MVC use this interface for validation purposes. In this article I will show how to build an abstract base class that implements IDataErrorInfo in a way that Validation Application Block is used under the covers.
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.
This article describes how to move the self validation methods of a type to its meta data type, using Validation Application Block 5.0. Using self validation methods inside Data Annotations' meta data type is something that is not supported out of the box.
This post describes how to take integration of Validation Application Block with ASP.NET Web Forms to the next level by introducing extension methods that centralize the creation of PropertyProxyValidator controls and enable compile time support. This post build on the code in the previous article and allows users to define value conversions.
This post describes how to take integration of Validation Application Block with ASP.NET Web Forms to the next level by introducing extension methods that centralize the creation of PropertyProxyValidator controls and enable compile time support.
Since I built CuttingEdge.Conditions, I had lots of positive reactions from developers who loved it. However, I've never saw the source code been reused in another library or framework; until now.
In .NET 4.0 the SmtpClient class now implements IDisposable. This is a breaking change what you should watch out for.
Bryan Sullivan describes in the May issue of his MSDN article a denial of service attack that abuses regular expressions. As Bryan explains, a poorly written regex can bring your server to its knees.
Microsoft published an interesting list of breaking changes in the just released .NET 4.0 framework.
This article describes how to build an IConfigurationSource implementation that allows validators, defined in a base class or interface, to be inherited by subclasses and implementations.
This article describes how to build an IConfigurationSource implementation that allows reading multiple configuration files that each contain part of the total Enterprise Library Validation Application Block configuration.
The last couple of days I've been having a Printer Jam on my way to work.
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
Visual Studio 2005 and 2008 contain a (not officially supported) feature that allows display of vertical guidelines in the (code) text editor. Visual Studio 2010 however, seems to completely miss this feature. I created a feature request on Microsoft Connect. Please help and vote for this feature to return.
This article describes the EntitySorter<T> class. It's a nifty little thing that allows the presentation layer to instruct the service layer how collections should be returned.
This article describes how to extract the validation configuration to its own file and allow this to also work with unit tests.
Integrating Enterprise Library Validation Application Block With LINQ to SQL and Entity Framework Part 4: Using Metadata to Automate Validations
This article describes how to extract information from your generated LINQ to SQL entities to automate validations like maximum string length and disallowing null values.
I just watched an amazing Google Talk video on YouTube that explains how botnets work.
This article describes what Cross-site request forgery attacks are and how to mitigate them.
The Microsoft Anti-Cross Site Scripting Library (Anti-XSS) is an encoding library designed to help developers protect their ASP.NET web-based applications from XSS attacks.
For over three years I've been using NDepend. In this post I'll describe my thoughts on NDepend.
Last week I published the first stable release of CuttingEdge.Conditions.
In this post I’ll describe another breaking change I’m making to my open source project, CuttingEdge.Conditions.
In this post I’ll describe a controversial change I’m making in my open source project, CuttingEdge.Conditions.
This post explains what’s wrong with ApplicationException and why it should not be used.
Last month I read ‘Microsoft .NET: Architecting Applications for the Enterprise’, written by Dino Esposito and Andrea Saltarello. This book is a great piece of work.
Just found this free ebook on the Red Gate site:
Dennis Doomen, architect at Aviva Solutions, published a set of C# 3.0 Coding Guidelines a few months ago. While a lot of different C# coding guidelines can be found on the web, this one caught my attention.
The Entity Framework Design blog just published a template that enables converting a LINQ to SQL .dbml file to a Entity Framework .edmx file.
... and all I got was this lousy CodePlex Sticker.
Integrating Enterprise Library Validation Application Block with LINQ to SQL and Entity Framework Part 3: The complexity of custom validators.
This article shows the complexity a developer is facing, implementing a custom validator while using an O/RM tool. While the article uses the Validation Application Block and LINQ to SQL in writing the validation logic, the problems encountered in the article are very general.
Tom Hollander describes on his blog a denial of service attack I never knew the existence of, called XML Entity Expansion attack. Tom explains how to bring a server to its knees when allowing any type of xml document as input and passing it directly to an XmlDocument for parsing.
Integrating Enterprise Library Validation Application Block with LINQ to SQL and Entity Framework Part 2: Using context within custom validators.
This article describes how to write custom validators for the Enterprise Library Validation Application Block, in such a way that it runs within the context of a specific LINQ to SQL DataContext or Entity Framework ObjectContext class, which allows analysis of non-persisted (in-memory) changes in that context.
Integrating Enterprise Library Validation Application Block With LINQ to SQL and Entity Framework Part 1: Basic Integration
This article describes how to integrate the Enterprise Library Validation Application Block in conjunction with an O/RM technology such as LINQ to SQL and Entity Framework.
One good spell checker and one really bad spell checker plug-in for Visual Studio.
This article describes the true danger of SQL injection attacks. The article shows how a hacker can steal your sensitive business data, even when your website connects to your database with a normal non-privileged login account.
This was announced some time ago at the PDC2008, but I just found out after watching the PDC session on Tips And Tracks For The Visal C# IDE.
The Microsoft ADO.NET team blog made an important announcement yesterday about the future of LINQ to SQL.
Did you ever wonder why .NET doesn't have a Temperature type? I suppose not, because I didn't find any implementation of such a thing on the internet.
The .NET JIT compiler has changed with the new SP1 release of the .NET 3.5 framework. Microsoft claims it's faster. I claim the opposite!
In a previous post I introduced CuttingEdge.Conditions, a library that helps developers to write pre- and postcondition validations in their .NET 3.5 code base. In this post I'll explain how you can extend the library.
CuttingEdge.Conditions is a library that helps developers to write pre- and postcondition validations in their .NET 3.5 code base. Writing these validations is easy and it improves the readability and maintainability of code.
Have you ever wondered why the C# language doesn't have a specific feature, or why it works the way it does? As a matter of fact, I did, and I mailed them over a year ago. I never got an answer though. Now I'm publishing this mail, hoping to start a good discussion.
The last couple of days I had some spare time. What does a workaholic do with spare time? Exactly: he builds his own library. :-)
I just reported a bug on the Microsoft Connect site about a quirk in the C# IntelliSense feature regarding generic extension methods.
Great news is coming from the .NET Runtime Team. The new coming service pack for the .NET framework addresses inlining of value types.
It has already been several months since I purchased the book Framework Design Guidelines by Krzysztof Cwalina and Brad Abrams. Since that time it proved itself to be invaluable. When you design or write reusable libraries or are concerned with the quality and usability of your API, this book is for you.
This article describes an implementation of a ReadOnlyDictionary <TKey, TValue> that's missing from the .NET framework.
Here's a link to a very interesting Channel 9 interview with Anders Hejlsberg, Herb Sutter, Erik Meijer, Brian Beckman about Software Composability and the Future of Languages.
While discussing the C# using statement with a colleague of mine, we discovered that there was a shorter version of the using statement possible.
This article describes my Visual Studio 2005 / Visual Studio 2008 template for rolling your own custom provider on the ASP.NET 2.0 Provider model. The model is actually not restricted to ASP.NET and this template allows you to create your custom provider for every type of .NET application, including console and forms applications.
The easiest way to convert a hexadecimal string to an integer is using System.Convert.
Sometimes I'm wondering strange things. For instance, this morning I was wondering if a static constructor of a class can create an instance of itself. It seemed to me this would be a conflicting requirement, because a classes constructor will only run after it's static constructor has run.
This article describes a little gotcha that might emerge when writing a custom parameter that derives from System.Web.UI.WebControls.Parameter.
Three weeks ago Joe Duffy published an article about 'Monitor.Enter, thread aborts, and orphaned locks' on his blog. After reading this article and responding to it (see my comments), I was pretty much in shock. I came to the conclusion that the C# ‘using’ statement isn't 100% safe.
This article describes how to inherit your .aspx pages from a custom class, in such a way that you can use nested master pages, without getting that terrible 'Design view does not support creating or editing nested master pages. To create or edit nested master pages, use Source view' from the Visual Studio Designer.
I came across this Google Tech Talk about Human Computation by Luis Von Ahn. Luis talks about how he uses humans to solve problems computers can't. His talk is really fascinating and funny. You should watch it!
Microsoft's ACE Team, announced the release of the Anti-Cross Site Scripting (XSS) Library version 1.5.
Here's a great article about passionate software developers. It is a must-read for every software developer.
ScottGu has blogged about this over 9 months ago, but I had some trouble finding that blog again. So this is for my own memory: Optimizing C# Refactoring Performance with Web Projects in VS 2005.