Skip to content
This repository was archived by the owner on Jan 24, 2021. It is now read-only.

Data annotations improvements #1279

Merged

Conversation

thecodejunkie
Copy link
Member

Re-designed the internals of the Data Annotations support. The various adapters are now discovered automatically and registered in the container.

@ghost ghost assigned thecodejunkie Oct 19, 2013
@thecodejunkie thecodejunkie mentioned this pull request Oct 19, 2013
7 tasks
Removed the old, static, factory that was used to create the adapters
between Nancy.Validation types and the various ValidationAttributes that
are used by Data Annotations

* DataAnnotationAdapters are now registered in the container and later
resolved from there. This means auto-discovery of new adapters + they
can take ctor dependencies just like any other moving part in Nancy

* Added auto-discovery of all the other types that are used by the
Nancy.Validation.DataAnnotations package

* The following types are registered using RegisterWithDefault:
IPropertyValidatorFactory and IValidateableObjectAdapter
@thecodejunkie
Copy link
Member Author

How do we handle the IEnumerable<IDataAnnotationsValidatorAdapter> adapters dependency, that DefaultPropertyValidatorFactory has, when it comes to the Unity-bootstrapper? All IEnumerable<T> dependencies needs a shim in order to be resolved by Unity

Currently we manually create the shim https://github.com/NancyFx/Nancy.Bootstrappers.Unity/blob/master/src/Nancy.Bootstrappers.Unity/UnityNancyBootstrapper.cs#L91 for any Nancy-core types, but the IDataAnnotationsValidatorAdapter is not in the core, so that won't be possible.

thecodejunkie added a commit that referenced this pull request Nov 4, 2013
@thecodejunkie thecodejunkie merged commit 651c21b into NancyFx:master Nov 4, 2013
@thecodejunkie thecodejunkie deleted the data-annotations-improvements branch February 17, 2016 07:55
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant