Your interface is internal (the default when you don't provide scope).
Windsor can't access internal objects (since they are internal to your
assembly only).  Make your interfaces public and you'll be all set.

---
Patrick Steele
http://weblogs.asp.net/psteele


On Thu, Feb 7, 2013 at 11:50 PM, Ramesh karn <[email protected]> wrote:

> I got the about exception when tried to use the factory method of Windsor,
> I'm relatively new with the Windsor please help me out. i'm posting my code
> along with the post.
>
> using System;
>>
>> using System.Windows.Forms;
>>
>> using Castle.Facilities.TypedFactory;
>>
>> using System.Collections.Generic;
>>
>> using System.Linq;
>>
>> using System.Text;
>>
>> using System.Threading.Tasks;
>>
>> using Castle.MicroKernel.Registration;
>>
>> using Castle.Windsor;
>>
>>
>>> namespace AsFactoryImplementation
>>
>> {
>>
>>     interface IDummyComponnentFactory
>>
>>     {
>>
>>         IDummyComponnent Creat();
>>
>> //        void Relese(IDummyComponnent factory);
>>
>>     }
>>
>>
>>>     interface IDummyComponnent
>>
>>     {
>>
>>         void Show();
>>
>>     }
>>
>>
>>>     class DummyComponnent:IDummyComponnent
>>
>>     {
>>
>>         public void Show()
>>
>>         {
>>
>>             Console.WriteLine("just testing this for better performance");
>>
>>         }
>>
>>     }
>>
>>
>>>     class Program:WindsorContainer
>>
>>     {
>>
>>         static void Main(string[] args)
>>
>>         {
>>
>>             var container = new WindsorContainer();
>>
>>             container.AddFacility<TypedFactoryFacility>();
>>
>>
>>
>>
>>> container.Register(Component.For<IDummyComponnent>().ImplementedBy<DummyComponnent>().Named("FirstConnection").LifeStyle.Transient
>>
>>                 , Component.For<IDummyComponnentFactory>().AsFactory());
>>
>>
>>
>>             var val = container.Resolve<IDummyComponnent>();
>>> // <<==== Exception comes here
>>
>>             val.Show();
>>
>>
>>
>>             var val2 = container.Resolve<IDummyComponnentFactory>();
>>
>>             var idummy = val2.Creat();
>>
>>
>>>         }
>>
>>     }
>>
>> }
>>
>>
>>  --
> You received this message because you are subscribed to the Google Groups
> "Castle Project Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected]
> .
> Visit this group at
> http://groups.google.com/group/castle-project-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

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


Reply via email to