Beispiel #1
0
 private static void RegisterEntryPointControllerDescriptionBuilder(this IComponentProvider container, Url entryPoint)
 {
     container.Register <IHttpControllerDescriptionBuilder, EntryPointControllerDescriptionBuilder>(
         entryPoint.ToString().Substring(1),
         () => new EntryPointControllerDescriptionBuilder(entryPoint, container.Resolve <IDefaultValueRelationSelector>()),
         Lifestyles.Singleton);
 }
Beispiel #2
0
        private static void RegisterControllerRelatedTypes(this IComponentProvider container, IEnumerable <Type> controllerTypes)
        {
            foreach (var controllerType in controllerTypes)
            {
                if (!controllerType.IsDescriptionController())
                {
                    container.Register(
                        typeof(IHttpControllerDescriptionBuilder <>).MakeGenericType(controllerType),
                        typeof(ControllerDescriptionBuilder <>).MakeGenericType(controllerType),
                        typeof(IHttpControllerDescriptionBuilder <>).MakeGenericType(controllerType).FullName,
                        lifestyle: Lifestyles.Singleton);
                }

                if (!typeof(EntryPointDescriptionController).IsAssignableFrom(controllerType))
                {
                    container.Register(
                        typeof(IHttpControllerDescriptionBuilder),
                        typeof(ControllerDescriptionBuilder <>).MakeGenericType(controllerType));
                }
            }
        }