views:

187

answers:

1

I get the following error when using sharparchitecture and try to call IValidatable.IsValid on a Domain Object.

How can I register an instance of the NHibernate validator against the common service locator?

I have seen the following unit tests:

http://code.google.com/p/sharp-architecture/source/browse/trunk/src/SharpArch/SharpArch.Tests/SharpArch.Core/SafeServiceLocatorTests.cs?spec=svn385&r=385

Any help with this would really be appreciated.

The needed dependency of type IValidator could not be located with the ServiceLocator.     You'll need to register it with the Common Service Locator (CSL) via your IoC's CSL adapter.

   at SharpArch.Core.SafeServiceLocator`1.GetService() in     C:\MyStuff\Projects\SharpArchGitHub\src\SharpArch\SharpArch.Core\SafeServiceLocator.cs:line 29
   at SharpArch.Core.DomainModel.ValidatableObject.IsValid() in     C:\MyStuff\Projects\SharpArchGitHub\src\SharpArch\SharpArch.Core\DomainModel\ValidatableObject  .cs:line 11
   at Tuhdoo.Common.Validation.ValidatableExtensions.Validate(IValidatable entity) in D:\Repository\Tuhdoo\src\Tuhdoo.Common\Validation\ValidatableExtensions.cs:line 26
A: 

This turned out to be pretty obvious I had a slap head moment when I realised I hadn't registered the IValidator with my DI Conatiner.

Burt