will be great!

For the other hand, calling "UsingFactoryMethod" without adding the 
"FactorySupportFacility" should throw an exception somewhere?

thank you again Craig and Tuna.


Craig Neuwirt escribió:
> I suspect you need to indicate that a target should be ommitted.  This 
> needs to be done on the ComponentModel via
>
> var options = ProxyUtil.ObtainProxyOptions(model, true);
> options.OmitTarget = true
>
> Unfortunately, this is not well exposed through the registration 
> interface, but I'll see if I can incorporate that automatically if 
> interceptors are registered for a model with interface or abstract 
> implementation or explicitly on interceptors descriptor.
>
> On Wed, Jul 1, 2009 at 2:31 PM, "José F. Romaniello" 
> <[email protected] <mailto:[email protected]>> wrote:
>
>
>     Hi Craig, with the first approach I get:
>
>     Castle.MicroKernel.ComponentActivator.ComponentActivatorException:
>     Could not find a public constructor for the type
>     ISomeService
>     in
>     
> Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.CreateInstance(CreationContext
>     context, Object[] arguments, Type[] signature)
>     in
>     
> Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.Instantiate(CreationContext
>     context)
>     in
>     
> Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.InternalCreate(CreationContext
>     context)
>     in
>     
> Castle.MicroKernel.ComponentActivator.AbstractComponentActivator.Create(CreationContext
>     context)
>     in
>     
> Castle.MicroKernel.Lifestyle.SingletonLifestyleManager.Resolve(CreationContext
>     context)
>     in
>     Castle.MicroKernel.Handlers.DefaultHandler.Resolve(CreationContext
>     context)
>     in
>     Castle.MicroKernel.DefaultKernel.ResolveComponent(IHandler
>     handler, Type service, IDictionary additionalArguments)
>     in Castle.MicroKernel.DefaultKernel.get_Item(Type service)
>     in Castle.Windsor.WindsorContainer.Resolve(Type service)
>     in Castle.Windsor.WindsorContainer.Resolve<T>()
>     in
>     
> uNHAddIns.Examples.CustomInterceptor.CustomerTest.Product_Raise_Property_Change()
>     en SomeTest.cs: line 43
>     
> <about:file%3A%2F%2F16CDF63B-1D9F-49EF-BEBA-F01ADA594882%2Ff%3ACustomerTest.cs%3Fline%3D43%26column%3D1>
>
>
>     With the second approach I get:
>
>     Castle.MicroKernel.ComponentRegistrationException: Type ISomeService
>     is abstract.
>      As such, it is not possible to instansiate it as implementation of
>     ISomeService service
>     in
>     
> Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.CreateInstance(CreationContext
>     context, Object[] arguments, Type[] signature)
>     in
>     
> Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.Instantiate(CreationContext
>     context)
>     in
>     
> Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.InternalCreate(CreationContext
>     context)
>     in
>     
> Castle.MicroKernel.ComponentActivator.AbstractComponentActivator.Create(CreationContext
>     context)
>     in
>     
> Castle.MicroKernel.Lifestyle.SingletonLifestyleManager.Resolve(CreationContext
>     context)
>     in
>     Castle.MicroKernel.Handlers.DefaultHandler.Resolve(CreationContext
>     context)
>     in
>     Castle.MicroKernel.DefaultKernel.ResolveComponent(IHandler
>     handler, Type service, IDictionary additionalArguments)
>     in Castle.MicroKernel.DefaultKernel.get_Item(Type service)
>     in Castle.Windsor.WindsorContainer.Resolve(Type service)
>     in Castle.Windsor.WindsorContainer.Resolve<T>()
>     in
>     
> uNHAddIns.Examples.CustomInterceptor.CustomerTest.Product_Raise_Property_Change()
>     en Some
>     
> <about:file%3A%2F%2F16CDF63B-1D9F-49EF-BEBA-F01ADA594882%2Ff%3ACustomerTest.cs%3Fline%3D43%26column%3D1>Test.cs:
>     line 51
>     
> <about:file%3A%2F%2F16CDF63B-1D9F-49EF-BEBA-F01ADA594882%2Ff%3ACustomerTest.cs%3Fline%3D51%26column%3D1>
>
>
>     Thank you.
>
>
>     Craig Neuwirt escribió:
>     > What error do yo get?
>     >
>     > On Wed, Jul 1, 2009 at 2:17 PM, JoseFR <[email protected]
>     <mailto:[email protected]>
>     > <mailto:[email protected] <mailto:[email protected]>>>
>     wrote:
>     >
>     >
>     >     Is there a way to register a proxy service in the container
>     without
>     >     target. I'm looking for something like this:
>     >
>     >     container.Register(Component.For<ISomeService>()
>     >                            .Interceptors(new
>     InterceptorReference(typeof
>     >     (SomeInterceptor)),
>     >                                               new
>     InterceptorReference
>     >     (typeof(OtherInterceptor)))
>     >                                              .First);
>     >
>     >     even I try with:
>     >
>     >                container.Register(Component.For<ISomeService>()
>     >
>     >      .UsingFactoryMethod
>     >     (() =>
>     >                                                    {
>     >                                                        var
>     proxyGen = new
>     >     Castle.DynamicProxy.ProxyGenerator();
>     >                                                        return
>     (IProduct)
>     >     proxyGen.CreateInterfaceProxyWithoutTarget(
>     >                                                            typeof
>     >     (ISomeService),
>     >                                                            new
>     >     SomeInterceptor(),
>     >                                                            new
>     >     OtherInterceptor());
>     >                                                    }));
>     >
>     >
>     >     Thanks in advance.
>     >
>     >
>     >
>     >
>     > >
>
>
>
>
>
> >


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/castle-project-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to