Hey Krzystof, your last reply got caught in my spam filter for some
reason.
I just tried this syntax and unfortunately now I get the following
exception (even before "YourFactory" is called):
Castle.Core.Internal.LateBoundComponent is not a
GenericTypeDefinition. MakeGenericType may only be called on a type
for which Type.IsGenericTypeDefinition is true.
Full stack trace:
[InvalidOperationException: Castle.Core.Internal.LateBoundComponent is
not a GenericTypeDefinition. MakeGenericType may only be called on a
type for which Type.IsGenericTypeDefinition is true.]
System.RuntimeType.MakeGenericType(Type[] instantiation) +9484789
Castle.MicroKernel.Handlers.DefaultGenericHandler.ResolveCore(CreationContext
context, Boolean requiresDecommission, Boolean instanceRequired) in e:
\OSS.Code\Castle.Windsor\src\Castle.Windsor\MicroKernel\Handlers
\DefaultGenericHandler.cs:52
Castle.MicroKernel.Handlers.AbstractHandler.Resolve(CreationContext
context, Boolean instanceRequired) in e:\OSS.Code\Castle.Windsor\src
\Castle.Windsor\MicroKernel\Handlers\AbstractHandler.cs:771
Castle.MicroKernel.Handlers.AbstractHandler.Resolve(CreationContext
context) in e:\OSS.Code\Castle.Windsor\src\Castle.Windsor\MicroKernel
\Handlers\AbstractHandler.cs:369
Castle.MicroKernel.Resolvers.DefaultDependencyResolver.ResolveServiceDependency(CreationContext
context, ComponentModel model, DependencyModel dependency) in e:
\OSS.Code\Castle.Windsor\src\Castle.Windsor\MicroKernel\Resolvers
\DefaultDependencyResolver.cs:390
Castle.MicroKernel.Resolvers.DefaultDependencyResolver.Resolve(CreationContext
context, ISubDependencyResolver contextHandlerResolver, ComponentModel
model, DependencyModel dependency) in e:\OSS.Code\Castle.Windsor\src
\Castle.Windsor\MicroKernel\Resolvers\DefaultDependencyResolver.cs:243
Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.CreateConstructorArgumentsCore(ConstructorCandidate
constructor, Object[] arguments, CreationContext context, Type[]
signature) in e:\OSS.Code\Castle.Windsor\src\Castle.Windsor\MicroKernel
\ComponentActivator\DefaultComponentActivator.cs:353
Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.CreateConstructorArguments(ConstructorCandidate
constructor, CreationContext context, Type[]& signature) in e:\OSS.Code
\Castle.Windsor\src\Castle.Windsor\MicroKernel\ComponentActivator
\DefaultComponentActivator.cs:338
Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.Instantiate(CreationContext
context) in e:\OSS.Code\Castle.Windsor\src\Castle.Windsor\MicroKernel
\ComponentActivator\DefaultComponentActivator.cs:90
Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.InternalCreate(CreationContext
context) in e:\OSS.Code\Castle.Windsor\src\Castle.Windsor\MicroKernel
\ComponentActivator\DefaultComponentActivator.cs:70
Castle.MicroKernel.ComponentActivator.AbstractComponentActivator.Create(CreationContext
context) in e:\OSS.Code\Castle.Windsor\src\Castle.Windsor\MicroKernel
\ComponentActivator\AbstractComponentActivator.cs:75
Castle.MicroKernel.Lifestyle.AbstractLifestyleManager.Resolve(CreationContext
context) in e:\OSS.Code\Castle.Windsor\src\Castle.Windsor\MicroKernel
\Lifestyle\AbstractLifestyleManager.cs:42
Castle.MicroKernel.Lifestyle.PerWebRequestLifestyleManager.Resolve(CreationContext
context) in e:\OSS.Code\Castle.Windsor\src\Castle.Windsor\MicroKernel
\Lifestyle\PerWebRequestLifestyleManager.cs:55
Nancy.BootStrappers.Windsor.HybridPerWebRequestLifestyleManager`1.Resolve(CreationContext
context) +125
Castle.MicroKernel.Handlers.DefaultHandler.ResolveCore(CreationContext
context, Boolean requiresDecommission, Boolean instanceRequired) in e:
\OSS.Code\Castle.Windsor\src\Castle.Windsor\MicroKernel\Handlers
\DefaultHandler.cs:61
Castle.MicroKernel.Handlers.AbstractHandler.Resolve(CreationContext
context, Boolean instanceRequired) in e:\OSS.Code\Castle.Windsor\src
\Castle.Windsor\MicroKernel\Handlers\AbstractHandler.cs:771
Castle.MicroKernel.Handlers.AbstractHandler.TryResolve(CreationContext
context) in e:\OSS.Code\Castle.Windsor\src\Castle.Windsor\MicroKernel
\Handlers\AbstractHandler.cs:376
Castle.MicroKernel.DefaultKernel.TryResolveComponent(IHandler
handler, Type service, IDictionary additionalArguments) in e:\OSS.Code
\Castle.Windsor\src\Castle.Windsor\MicroKernel\DefaultKernel.cs:915
Castle.MicroKernel.DefaultKernel.ResolveAll(Type service,
IDictionary arguments) in e:\OSS.Code\Castle.Windsor\src\Castle.Windsor
\MicroKernel\DefaultKernel_Resolve.cs:277
Castle.MicroKernel.DefaultKernel.ResolveAll(Type service) in e:
\OSS.Code\Castle.Windsor\src\Castle.Windsor\MicroKernel
\DefaultKernel_Resolve.cs:250
Castle.Windsor.WindsorContainer.ResolveAll(Type service) in e:
\OSS.Code\Castle.Windsor\src\Castle.Windsor\Windsor
\WindsorContainer.cs:896
Castle.Windsor.WindsorContainer.ResolveAll() in e:\OSS.Code
\Castle.Windsor\src\Castle.Windsor\Windsor\WindsorContainer.cs:891
Nancy.Bootstrappers.Windsor.WindsorNancyAspNetBootstrapper.GetAllModules(IWindsorContainer
container) +63
Nancy.Bootstrapper.NancyBootstrapperWithRequestContainerBase`1.GetAllModules(NancyContext
context) +78
Nancy.Routing.RouteCache..ctor(INancyModuleCatalog moduleCatalog,
IModuleKeyGenerator moduleKeyGenerator, INancyContextFactory
contextFactory) +112
On May 17, 1:07 am, Krzysztof Koźmic <
krzysztof.koz...@gmail.com>
wrote:
> .UsingFactoryMethod((k,m,c) => YourFactory(m.Implementation));
>
> On 17/05/2012 5:35 PM, Nik Pinski wrote:
>
>
>
>
>
>
>
> > Could you be a little more clear? This really isn't much to go on,
> > and while I understand conceptually the kind of reflection the factory
> > method would have to do, I don't understand how to register the
> > generic MyGenericObject<T> where T is passed in to the factory method...
>
> > On Tue, May 15, 2012 at 2:59 AM, Krzysztof Koźmic
> > <
krzysztof.koz...@gmail.com <mailto:
krzysztof.koz...@gmail.com>> wrote:
>
> > yes
>
> > On 15/05/2012 8:54 AM, npinski wrote:
>
> > That's fine. But i'm not sure I understand...what kind of
> > signature
> > would the configuration have to have? I assume you are
> > implying the
> > type of the generic parameter would need to be passed in to the
> > factory method?
>
> > On May 11, 3:45 pm, Krzysztof
> > Koźmic<
krzysztof.koz...@gmail.com
> > <mailto:
krzysztof.koz...@gmail.com>>
> > <mailto:
castle-pro...@googlegroups.com>.
> > <mailto:
castle-project-devel%2Bunsu...@googlegroups.com>.