Tuesday, June 19, 2007

WCSF June 2007 Release

It's been less then two weeks after the release of the release candidate WCSF v1.1, you now can download the official release. Go here to read details.

Friday, June 8, 2007

RC WCSF 1.1 released

Yesterday I posted that the WCSF 1.1 will be released early next week. Today you can already download the release candidate of WCSF 1.1.
Related links:

Thursday, June 7, 2007

WCSF 1.1 releases next week

According David Hayden, the new version of WCSF will be released early next week. For WCSF users this is something to look forward to, because some pretty nasty bug are removed and it supports Enterprise Library 3.1. This means that new application blocks, like Validation Application Block and Policy Injection Block, can be used in your WCSF-apps.

Tuesday, May 29, 2007

A real-world example of a CruiseControl.NET setup

I was searching for some good guidelines to setup CruiseControl.NET, because we are tend to use it in our project. I came across a tutorial which describes the setup of a integration server using CruiseControl.NET, based on a real-world development project. The article contains a lot of XML configuration and the author explains each line of code. Read it!!

Monday, May 21, 2007

WCSF 1.1 release

WCSF is about to be released. The P&P team will start testing next week, so WCSF 1.1 is coming soon. Also interesting is the fact that WCSF 1.1 will be compatible with Enterprise Library 3.1. Things to look forward to...

Wednesday, May 16, 2007

WCSF and Enterprise Library 3.0

The current release of WCSF does not support Enterprise Library 3.0, but it is planned in the next upcoming release. For those of you who can't wait for the next release, there is workaround to compile WCSF with EntLib 3.0. Here you can read an excellent article about it.

Wednesday, May 9, 2007

Creating a simple generic base implementation of a validatable business entity using the Validation Application Block

Almost every respectable application is build within in layered architecture. The most common layers are data access layer (DAL), business logic layer (BLL) and user interface layer (UI). When using the ASP.NET technology to create a user interface, the most common scenario to validate data is to drag some validator controls on the web page (f.e. RequiredFieldValidator) and bind them to the controls containing data that should be validated. But nowadays, when we speak about Service Oriented Architectures, your data could be exposed to other applications, which has different validation rules. So in order to protect your database from malicious input, it could be necessary to validate your business entities at business logic level before the data will be persisted to your data source.

I was looking for a solid base for my entity validation, without having to do a lot of coding. So recently I downloaded Microsoft Enterprise Library 3.0, which contains an entity validation block. To be able to run the code in this article, you need to download and install enterprise library 3.0. Also take a look at the prerequisites of the installation. In this example, I would like to show you how to create a base implementation of a validatable entity which can be reused through your domain logic.

First I created an interface IValidatableObject

public interface IValidatableObject
{
bool IsValid { get; }
}

The interface is the contract for every entity that should be validated. To create a generic base implementation, I created a new class which inherits from the interface:
First you have to make sure that you have a reference to the validation namespace:

using Microsoft.Practices.EnterpriseLibrary.Validation;

public class BusinessEntityBase<TEntity> : IValidatableObject
{
private ValidationResults _validationResults;

public BusinessEntityBase()
{
_validationResults = new ValidationResults();
}

public bool IsValid
{
get
{
//Create a validator using the validator factory
Validator validator = ValidationFactory.CreateValidator<TEntity>();

//Validate the entity based on the validation rules and put the result
//in the ValidationResults field

validator.Validate(this, _validationResults);

return _validationResults.IsValid;
}
}

public ValidationResults ValidationResults
{
get{return _validationResults;}
}
}

The next step is the implementation of your business entity itself. So every business entity in your domain logic that must be validatable, should inherit from base class
BusinessEntityBase. To add validation to the business entity, you have to decorate the properties with validator attributes. There are other ways to specify validation
rules (like an XML-configuration), but for now we are going to use attributes:

public class MyEntity : BusinessEntityBase<MyEntity>
{
private string _property1;

public MyEntity(){}

[StringLengthValidator(5, 10, MessageTemplate="The content of Property1 is not valid")]
public string Property1
{
get { return _property1; }
set { _property1 = value; }
}
}

Now we only have to do a simple test to see if the implementation really works. We expect that Property1 contains at least 5 characters and maximum 10 characters. The first assertion expects that the entity is not valid because it contains only 4 characters. The second assertion expects that the entity now is valid because contains 5 characters.

MyEntity target = new MyEntity();

target.Property1 = "1234";
Assert.IsFalse(target.IsValid);

target.Property1 = "12345";
Assert.IsTrue(target.IsValid);

In the future I will spend more time writing articles about entity validation. Enterprise Library 3.0 has built-in functionality to directly use entity validation in web forms and windows forms, on which I'll write some more articles about in the future..

Friday, May 4, 2007

NHibernate 1.2 released

A stable version of NHibernate 1.2 has been released. There seems to be a lot of improvements towards .NET 2.0. Here are a couple of new features:

  • Filters - (I really wish that I had them when I started my previous project)

  • Generic Collections

  • Database generated properties.

  • SQL Dependencies for NHibernate's cache


You can download it here. A complete list of new featurs and bugfixes can be found here.


Monday, April 23, 2007

WCSF Tip: Changing Module Assembly Names

There's something with the latest release of WCSF you definitely have to know when you try to change the assembly name of a module. This is something I came across too, and I also found out how to solve it. I was ready to blog about it, but someone else was ahead of me.... click here to go to the article.

Tuesday, April 17, 2007

WCSF Workshop

On March 12 & 13 the Patterns & Practices Team has organised a workshop about WCSF. They now have published their presentations on the internet and are free to download. Click here to go to the download page.