Exemplo n.º 1
0
        private static AnnotatedHandlerInspector CreateInspector(Type inspectedType, IParameterResolverFactory parameterResolverFactory, IHandlerDefinition handlerDefinition, Dictionary <Type, AnnotatedHandlerInspector> registry)
        {
            if (!registry.ContainsKey(inspectedType))
            {
                registry[inspectedType] = AnnotatedHandlerInspector.Initialize(inspectedType, parameterResolverFactory, handlerDefinition, registry);
            }

            return(registry[inspectedType]);
        }
Exemplo n.º 2
0
        private static AnnotatedHandlerInspector Initialize(Type inspectedType, IParameterResolverFactory parameterResolverFactory, IHandlerDefinition handlerDefinition, Dictionary <Type, AnnotatedHandlerInspector> registry)
        {
            var parents = new List <AnnotatedHandlerInspector>();

            foreach (var iface in inspectedType.GetInterfaces())
            {
                parents.Add(CreateInspector(iface, parameterResolverFactory, handlerDefinition, registry));
            }

            if (inspectedType.BaseType != null && typeof(object) != inspectedType.BaseType)
            {
                parents.Add(CreateInspector(inspectedType.BaseType, parameterResolverFactory, handlerDefinition, registry));
            }
            var inspector = new AnnotatedHandlerInspector(inspectedType, parents, parameterResolverFactory, handlerDefinition, registry);

            inspector.InitializeMessageHandlers(parameterResolverFactory, handlerDefinition);
            return(inspector);
        }
Exemplo n.º 3
0
 public AnnotatedHandlerInspector Inspect(Type entityType)
 {
     return(AnnotatedHandlerInspector.CreateInspector(entityType, _parameterResolverFactory, _handlerDefinition, _registry));
 }