MvcExtensions/Core — pull request #1 by AlexBar (2012-04-13 21:56:31+00:00)
Title: Standalone Fluent ModelMetadata configuration registration

Added ability to use only Fluent ModelMetadata configuration without bootstrapping features of MvcExtensions.

Usage (example with Autofac):

// Global.asax.cs
protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();

RegisterGlobalFilters(GlobalFilters.Filters);
RegisterRoutes(RouteTable.Routes);

ContainerBuilder builder = new ContainerBuilder();

var current = ModelMetadataRegistrator.Current;
current.RegisterMetadataTypes(
(serviceType, implType) => builder.RegisterType(implType).As(serviceType).InstancePerDependency(),
(serviceType, implType) => builder.RegisterType(implType).As(serviceType).SingleInstance());

DependencyResolver.SetResolver(new AutofacDependencyResolver(builder.Build()));

current.RegisterMetadataProviders(DependencyResolver.Current);
}