xVal Integration

In a recent project I used my Fluent Metadata library to add validation metadata to properties.
Due to me not wanting to add DataAnnotation Attributes directly in my Model files, I used Fluent Metadata to do the job.

xVal integration is available since revision 31750.

Using FluentMetadata with xVal integration in your project

This feature is planned for version 0.3 of the library, however you can get the latest source from SVN and build it fairly easily.

Copy all the DLL's from FluentMetadata.xValIntegration/bin to your lib directory.

In the Global.asax code behind file add the following to Application_Start():

xVal.ActiveRuleProviders.Providers.Clear();
xVal.ActiveRuleProviders.Providers.Add(
     new FluentMetadataRuleProvider(
         new FluentMetadataProvider(
             TypeDescriptor.GetProvider(typeof(<<Insert one of your model types here>>))
         )
     )
);

Last edited Oct 8, 2009 at 10:47 PM by jvandertil, version 3

Comments

No comments yet.