Re: [enix commit: 5222]: /trunk/InversionOfControl/Castle.MicroKernel/Registration/

View: New views
9 Messages — Rating Filter:   Alert me  

Parent Message unknown Re: [enix commit: 5222]: /trunk/InversionOfControl/Castle.MicroKernel/Registration/

by Roelof Blom :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

This breaks the Wcf facility (and probably more stuff, but I'm not sure). For instance, in Wcf facility there's no service metadata available because ComponentModel.Configuration is never set, causing WcfUtils.FindBehaviors<> to never find any IServiceBehavior handlers.

I think that the problem is that ComponentRegistration is not using ComponentModelBuilder for construction, but new'ing ComponentModel instead.

Any objections to reverting this patch?

-- Roelof.

On Wed, Jul 9, 2008 at 3:12 PM, <notification@...> wrote:

User: enix
Date: 2008/07/09 06:12 AM

Modified:
 /trunk/InversionOfControl/Castle.MicroKernel/Registration/
 ComponentInstanceDescriptor.cs, ComponentRegistration.cs

Log:
 Better fix for the dependency exception that occurred when resolving a component instance that has c'tor arguments. This patch excluded the component from being inspected for registration. This allows the registration of Stub instanced generated by Rhino.Mocks.

File Changes:

Directory: /trunk/InversionOfControl/Castle.MicroKernel/Registration/
=====================================================================

File [modified]: ComponentInstanceDescriptor.cs
Delta lines: +0 -5
===================================================================
--- trunk/InversionOfControl/Castle.MicroKernel/Registration/ComponentInstanceDescriptor.cs     2008-07-08 20:49:29 UTC (rev 5221)
+++ trunk/InversionOfControl/Castle.MicroKernel/Registration/ComponentInstanceDescriptor.cs     2008-07-09 13:12:54 UTC (rev 5222)
@@ -30,11 +30,6 @@
               {
                       model.CustomComponentActivator = typeof(ExternalInstanceActivator);
                       model.ExtendedProperties["instance"] = instance;
-
-                       // The constructor collection is filled because the instance gets inspected
-                       // by the kernel when added. The kernel doesn't need to resolve any
-                       // dependencies since we pass an instance.
-                       model.Constructors.Clear();
               }
       }
 }
\ No newline at end of file

File [modified]: ComponentRegistration.cs
Delta lines: +9 -4
===================================================================
--- trunk/InversionOfControl/Castle.MicroKernel/Registration/ComponentRegistration.cs   2008-07-08 20:49:29 UTC (rev 5221)
+++ trunk/InversionOfControl/Castle.MicroKernel/Registration/ComponentRegistration.cs   2008-07-09 13:12:54 UTC (rev 5222)
@@ -37,6 +37,7 @@
       {
               private String name;
               private bool overwrite;
+               private bool isInstanceRegistration;
               private Type serviceType;
               private Type implementation;
               private List<Type> forwardedTypes = new List<Type>();
@@ -159,6 +160,7 @@
                               throw new ArgumentNullException("instance");
                       }

+                       isInstanceRegistration = true;
                       ImplementedBy(instance.GetType());
                       return AddDescriptor(new ComponentInstanceDescriptior<S>(instance));
               }
@@ -504,12 +506,15 @@
                                       descriptor.ApplyToConfiguration(kernel, configuration);
                               }

-                               if (componentModel == null)
+                               if (componentModel == null && isInstanceRegistration == false)
                               {
-                                       componentModel = kernel.ComponentModelBuilder.BuildModel(
-                                               name, serviceType, implementation, null);
+                    componentModel = kernel.ComponentModelBuilder.BuildModel(name, serviceType, implementation, null);
+                               }
+                               else if (componentModel == null && isInstanceRegistration)
+                               {
+                                       componentModel = new ComponentModel(name, serviceType, implementation);
                               }
-
+
                               foreach (ComponentDescriptor<S> descriptor in descriptors)
                               {
                                       descriptor.ApplyToModel(kernel, componentModel);





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


Re: [enix commit: 5222]: /trunk/InversionOfControl/Castle.MicroKernel/Registration/

by Markus Zywitza :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


In fact, the patch is required for injecting objects created by
Rhino.Mocks. I would revert it due to the fact that it breaks
production code, but make sure that you reopen the issue at Jira.

-Markus

On Wed, Jul 23, 2008 at 23:59, Roelof Blom <roelof.blom@...> wrote:

> Hi,
>
> This breaks the Wcf facility (and probably more stuff, but I'm not sure).
> For instance, in Wcf facility there's no service metadata available because
> ComponentModel.Configuration is never set, causing WcfUtils.FindBehaviors<>
> to never find any IServiceBehavior handlers.
>
> I think that the problem is that ComponentRegistration is not using
> ComponentModelBuilder for construction, but new'ing ComponentModel instead.
>
> Any objections to reverting this patch?
>
> -- Roelof.
>
> On Wed, Jul 9, 2008 at 3:12 PM, <notification@...> wrote:
>>
>> User: enix
>> Date: 2008/07/09 06:12 AM
>>
>> Modified:
>>  /trunk/InversionOfControl/Castle.MicroKernel/Registration/
>>  ComponentInstanceDescriptor.cs, ComponentRegistration.cs
>>
>> Log:
>>  Better fix for the dependency exception that occurred when resolving a
>> component instance that has c'tor arguments. This patch excluded the
>> component from being inspected for registration. This allows the
>> registration of Stub instanced generated by Rhino.Mocks.
>>
>> File Changes:
>>
>> Directory: /trunk/InversionOfControl/Castle.MicroKernel/Registration/
>> =====================================================================
>>
>> File [modified]: ComponentInstanceDescriptor.cs
>> Delta lines: +0 -5
>> ===================================================================
>> ---
>> trunk/InversionOfControl/Castle.MicroKernel/Registration/ComponentInstanceDescriptor.cs
>>     2008-07-08 20:49:29 UTC (rev 5221)
>> +++
>> trunk/InversionOfControl/Castle.MicroKernel/Registration/ComponentInstanceDescriptor.cs
>>     2008-07-09 13:12:54 UTC (rev 5222)
>> @@ -30,11 +30,6 @@
>>                {
>>                        model.CustomComponentActivator =
>> typeof(ExternalInstanceActivator);
>>                        model.ExtendedProperties["instance"] = instance;
>> -
>> -                       // The constructor collection is filled because
>> the instance gets inspected
>> -                       // by the kernel when added. The kernel doesn't
>> need to resolve any
>> -                       // dependencies since we pass an instance.
>> -                       model.Constructors.Clear();
>>                }
>>        }
>>  }
>> \ No newline at end of file
>>
>> File [modified]: ComponentRegistration.cs
>> Delta lines: +9 -4
>> ===================================================================
>> ---
>> trunk/InversionOfControl/Castle.MicroKernel/Registration/ComponentRegistration.cs
>>   2008-07-08 20:49:29 UTC (rev 5221)
>> +++
>> trunk/InversionOfControl/Castle.MicroKernel/Registration/ComponentRegistration.cs
>>   2008-07-09 13:12:54 UTC (rev 5222)
>> @@ -37,6 +37,7 @@
>>        {
>>                private String name;
>>                private bool overwrite;
>> +               private bool isInstanceRegistration;
>>                private Type serviceType;
>>                private Type implementation;
>>                private List<Type> forwardedTypes = new List<Type>();
>> @@ -159,6 +160,7 @@
>>                                throw new
>> ArgumentNullException("instance");
>>                        }
>>
>> +                       isInstanceRegistration = true;
>>                        ImplementedBy(instance.GetType());
>>                        return AddDescriptor(new
>> ComponentInstanceDescriptior<S>(instance));
>>                }
>> @@ -504,12 +506,15 @@
>>
>>  descriptor.ApplyToConfiguration(kernel, configuration);
>>                                }
>>
>> -                               if (componentModel == null)
>> +                               if (componentModel == null &&
>> isInstanceRegistration == false)
>>                                {
>> -                                       componentModel =
>> kernel.ComponentModelBuilder.BuildModel(
>> -                                               name, serviceType,
>> implementation, null);
>> +                    componentModel =
>> kernel.ComponentModelBuilder.BuildModel(name, serviceType, implementation,
>> null);
>> +                               }
>> +                               else if (componentModel == null &&
>> isInstanceRegistration)
>> +                               {
>> +                                       componentModel = new
>> ComponentModel(name, serviceType, implementation);
>>                                }
>> -
>> +
>>                                foreach (ComponentDescriptor<S> descriptor
>> in descriptors)
>>                                {
>>                                        descriptor.ApplyToModel(kernel,
>> componentModel);
>>
>>
>>
>
>
> >
>

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


Re: [enix commit: 5222]: /trunk/InversionOfControl/Castle.MicroKernel/Registration/

by Craig Neuwirt :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Do you know exactly what the original problem was that caused the initial changes?

On Wed, Jul 23, 2008 at 4:59 PM, Roelof Blom <roelof.blom@...> wrote:
Hi,

This breaks the Wcf facility (and probably more stuff, but I'm not sure). For instance, in Wcf facility there's no service metadata available because ComponentModel.Configuration is never set, causing WcfUtils.FindBehaviors<> to never find any IServiceBehavior handlers.

I think that the problem is that ComponentRegistration is not using ComponentModelBuilder for construction, but new'ing ComponentModel instead.

Any objections to reverting this patch?

-- Roelof.

On Wed, Jul 9, 2008 at 3:12 PM, <notification@...> wrote:

User: enix
Date: 2008/07/09 06:12 AM

Modified:
 /trunk/InversionOfControl/Castle.MicroKernel/Registration/
 ComponentInstanceDescriptor.cs, ComponentRegistration.cs

Log:
 Better fix for the dependency exception that occurred when resolving a component instance that has c'tor arguments. This patch excluded the component from being inspected for registration. This allows the registration of Stub instanced generated by Rhino.Mocks.

File Changes:

Directory: /trunk/InversionOfControl/Castle.MicroKernel/Registration/
=====================================================================

File [modified]: ComponentInstanceDescriptor.cs
Delta lines: +0 -5
===================================================================
--- trunk/InversionOfControl/Castle.MicroKernel/Registration/ComponentInstanceDescriptor.cs     2008-07-08 20:49:29 UTC (rev 5221)
+++ trunk/InversionOfControl/Castle.MicroKernel/Registration/ComponentInstanceDescriptor.cs     2008-07-09 13:12:54 UTC (rev 5222)
@@ -30,11 +30,6 @@
               {
                       model.CustomComponentActivator = typeof(ExternalInstanceActivator);
                       model.ExtendedProperties["instance"] = instance;
-
-                       // The constructor collection is filled because the instance gets inspected
-                       // by the kernel when added. The kernel doesn't need to resolve any
-                       // dependencies since we pass an instance.
-                       model.Constructors.Clear();
               }
       }
 }
\ No newline at end of file

File [modified]: ComponentRegistration.cs
Delta lines: +9 -4
===================================================================
--- trunk/InversionOfControl/Castle.MicroKernel/Registration/ComponentRegistration.cs   2008-07-08 20:49:29 UTC (rev 5221)
+++ trunk/InversionOfControl/Castle.MicroKernel/Registration/ComponentRegistration.cs   2008-07-09 13:12:54 UTC (rev 5222)
@@ -37,6 +37,7 @@
       {
               private String name;
               private bool overwrite;
+               private bool isInstanceRegistration;
               private Type serviceType;
               private Type implementation;
               private List<Type> forwardedTypes = new List<Type>();
@@ -159,6 +160,7 @@
                               throw new ArgumentNullException("instance");
                       }

+                       isInstanceRegistration = true;
                       ImplementedBy(instance.GetType());
                       return AddDescriptor(new ComponentInstanceDescriptior<S>(instance));
               }
@@ -504,12 +506,15 @@
                                       descriptor.ApplyToConfiguration(kernel, configuration);
                               }

-                               if (componentModel == null)
+                               if (componentModel == null && isInstanceRegistration == false)
                               {
-                                       componentModel = kernel.ComponentModelBuilder.BuildModel(
-                                               name, serviceType, implementation, null);
+                    componentModel = kernel.ComponentModelBuilder.BuildModel(name, serviceType, implementation, null);
+                               }
+                               else if (componentModel == null && isInstanceRegistration)
+                               {
+                                       componentModel = new ComponentModel(name, serviceType, implementation);
                               }
-
+
                               foreach (ComponentDescriptor<S> descriptor in descriptors)
                               {
                                       descriptor.ApplyToModel(kernel, componentModel);








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


Re: [enix commit: 5222]: /trunk/InversionOfControl/Castle.MicroKernel/Registration/

by Roelof Blom :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Do you mean what this patch was supposed to fix?

On Thu, Jul 24, 2008 at 2:04 PM, Craig Neuwirt <cneuwirt@...> wrote:
Do you know exactly what the original problem was that caused the initial changes?


On Wed, Jul 23, 2008 at 4:59 PM, Roelof Blom <roelof.blom@...> wrote:
Hi,

This breaks the Wcf facility (and probably more stuff, but I'm not sure). For instance, in Wcf facility there's no service metadata available because ComponentModel.Configuration is never set, causing WcfUtils.FindBehaviors<> to never find any IServiceBehavior handlers.

I think that the problem is that ComponentRegistration is not using ComponentModelBuilder for construction, but new'ing ComponentModel instead.

Any objections to reverting this patch?

-- Roelof.

On Wed, Jul 9, 2008 at 3:12 PM, <notification@...> wrote:

User: enix
Date: 2008/07/09 06:12 AM

Modified:
 /trunk/InversionOfControl/Castle.MicroKernel/Registration/
 ComponentInstanceDescriptor.cs, ComponentRegistration.cs

Log:
 Better fix for the dependency exception that occurred when resolving a component instance that has c'tor arguments. This patch excluded the component from being inspected for registration. This allows the registration of Stub instanced generated by Rhino.Mocks.

File Changes:

Directory: /trunk/InversionOfControl/Castle.MicroKernel/Registration/
=====================================================================

File [modified]: ComponentInstanceDescriptor.cs
Delta lines: +0 -5
===================================================================
--- trunk/InversionOfControl/Castle.MicroKernel/Registration/ComponentInstanceDescriptor.cs     2008-07-08 20:49:29 UTC (rev 5221)
+++ trunk/InversionOfControl/Castle.MicroKernel/Registration/ComponentInstanceDescriptor.cs     2008-07-09 13:12:54 UTC (rev 5222)
@@ -30,11 +30,6 @@
               {
                       model.CustomComponentActivator = typeof(ExternalInstanceActivator);
                       model.ExtendedProperties["instance"] = instance;
-
-                       // The constructor collection is filled because the instance gets inspected
-                       // by the kernel when added. The kernel doesn't need to resolve any
-                       // dependencies since we pass an instance.
-                       model.Constructors.Clear();
               }
       }
 }
\ No newline at end of file

File [modified]: ComponentRegistration.cs
Delta lines: +9 -4
===================================================================
--- trunk/InversionOfControl/Castle.MicroKernel/Registration/ComponentRegistration.cs   2008-07-08 20:49:29 UTC (rev 5221)
+++ trunk/InversionOfControl/Castle.MicroKernel/Registration/ComponentRegistration.cs   2008-07-09 13:12:54 UTC (rev 5222)
@@ -37,6 +37,7 @@
       {
               private String name;
               private bool overwrite;
+               private bool isInstanceRegistration;
               private Type serviceType;
               private Type implementation;
               private List<Type> forwardedTypes = new List<Type>();
@@ -159,6 +160,7 @@
                               throw new ArgumentNullException("instance");
                       }

+                       isInstanceRegistration = true;
                       ImplementedBy(instance.GetType());
                       return AddDescriptor(new ComponentInstanceDescriptior<S>(instance));
               }
@@ -504,12 +506,15 @@
                                       descriptor.ApplyToConfiguration(kernel, configuration);
                               }

-                               if (componentModel == null)
+                               if (componentModel == null && isInstanceRegistration == false)
                               {
-                                       componentModel = kernel.ComponentModelBuilder.BuildModel(
-                                               name, serviceType, implementation, null);
+                    componentModel = kernel.ComponentModelBuilder.BuildModel(name, serviceType, implementation, null);
+                               }
+                               else if (componentModel == null && isInstanceRegistration)
+                               {
+                                       componentModel = new ComponentModel(name, serviceType, implementation);
                               }
-
+
                               foreach (ComponentDescriptor<S> descriptor in descriptors)
                               {
                                       descriptor.ApplyToModel(kernel, componentModel);











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


Re: [enix commit: 5222]: /trunk/InversionOfControl/Castle.MicroKernel/Registration/

by Craig Neuwirt :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Yeah.  In particular the first patch that performed the constructor clear.

On Thu, Jul 24, 2008 at 7:43 AM, Roelof Blom <roelof.blom@...> wrote:
Do you mean what this patch was supposed to fix?


On Thu, Jul 24, 2008 at 2:04 PM, Craig Neuwirt <cneuwirt@...> wrote:
Do you know exactly what the original problem was that caused the initial changes?


On Wed, Jul 23, 2008 at 4:59 PM, Roelof Blom <roelof.blom@...> wrote:
Hi,

This breaks the Wcf facility (and probably more stuff, but I'm not sure). For instance, in Wcf facility there's no service metadata available because ComponentModel.Configuration is never set, causing WcfUtils.FindBehaviors<> to never find any IServiceBehavior handlers.

I think that the problem is that ComponentRegistration is not using ComponentModelBuilder for construction, but new'ing ComponentModel instead.

Any objections to reverting this patch?

-- Roelof.

On Wed, Jul 9, 2008 at 3:12 PM, <notification@...> wrote:

User: enix
Date: 2008/07/09 06:12 AM

Modified:
 /trunk/InversionOfControl/Castle.MicroKernel/Registration/
 ComponentInstanceDescriptor.cs, ComponentRegistration.cs

Log:
 Better fix for the dependency exception that occurred when resolving a component instance that has c'tor arguments. This patch excluded the component from being inspected for registration. This allows the registration of Stub instanced generated by Rhino.Mocks.

File Changes:

Directory: /trunk/InversionOfControl/Castle.MicroKernel/Registration/
=====================================================================

File [modified]: ComponentInstanceDescriptor.cs
Delta lines: +0 -5
===================================================================
--- trunk/InversionOfControl/Castle.MicroKernel/Registration/ComponentInstanceDescriptor.cs     2008-07-08 20:49:29 UTC (rev 5221)
+++ trunk/InversionOfControl/Castle.MicroKernel/Registration/ComponentInstanceDescriptor.cs     2008-07-09 13:12:54 UTC (rev 5222)
@@ -30,11 +30,6 @@
               {
                       model.CustomComponentActivator = typeof(ExternalInstanceActivator);
                       model.ExtendedProperties["instance"] = instance;
-
-                       // The constructor collection is filled because the instance gets inspected
-                       // by the kernel when added. The kernel doesn't need to resolve any
-                       // dependencies since we pass an instance.
-                       model.Constructors.Clear();
               }
       }
 }
\ No newline at end of file

File [modified]: ComponentRegistration.cs
Delta lines: +9 -4
===================================================================
--- trunk/InversionOfControl/Castle.MicroKernel/Registration/ComponentRegistration.cs   2008-07-08 20:49:29 UTC (rev 5221)
+++ trunk/InversionOfControl/Castle.MicroKernel/Registration/ComponentRegistration.cs   2008-07-09 13:12:54 UTC (rev 5222)
@@ -37,6 +37,7 @@
       {
               private String name;
               private bool overwrite;
+               private bool isInstanceRegistration;
               private Type serviceType;
               private Type implementation;
               private List<Type> forwardedTypes = new List<Type>();
@@ -159,6 +160,7 @@
                               throw new ArgumentNullException("instance");
                       }

+                       isInstanceRegistration = true;
                       ImplementedBy(instance.GetType());
                       return AddDescriptor(new ComponentInstanceDescriptior<S>(instance));
               }
@@ -504,12 +506,15 @@
                                       descriptor.ApplyToConfiguration(kernel, configuration);
                               }

-                               if (componentModel == null)
+                               if (componentModel == null && isInstanceRegistration == false)
                               {
-                                       componentModel = kernel.ComponentModelBuilder.BuildModel(
-                                               name, serviceType, implementation, null);
+                    componentModel = kernel.ComponentModelBuilder.BuildModel(name, serviceType, implementation, null);
+                               }
+                               else if (componentModel == null && isInstanceRegistration)
+                               {
+                                       componentModel = new ComponentModel(name, serviceType, implementation);
                               }
-
+
                               foreach (ComponentDescriptor<S> descriptor in descriptors)
                               {
                                       descriptor.ApplyToModel(kernel, componentModel);














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


Re: [enix commit: 5222]: /trunk/InversionOfControl/Castle.MicroKernel/Registration/

by Roelof Blom :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Don't know, I've searched the list but could not find any related discussions. Adding the fact there's no failing test case either it's hard to tell what the original problem was.

On Thu, Jul 24, 2008 at 3:12 PM, Craig Neuwirt <cneuwirt@...> wrote:
Yeah.  In particular the first patch that performed the constructor clear.


On Thu, Jul 24, 2008 at 7:43 AM, Roelof Blom <roelof.blom@...> wrote:
Do you mean what this patch was supposed to fix?


On Thu, Jul 24, 2008 at 2:04 PM, Craig Neuwirt <cneuwirt@...> wrote:
Do you know exactly what the original problem was that caused the initial changes?


On Wed, Jul 23, 2008 at 4:59 PM, Roelof Blom <roelof.blom@...> wrote:
Hi,

This breaks the Wcf facility (and probably more stuff, but I'm not sure). For instance, in Wcf facility there's no service metadata available because ComponentModel.Configuration is never set, causing WcfUtils.FindBehaviors<> to never find any IServiceBehavior handlers.

I think that the problem is that ComponentRegistration is not using ComponentModelBuilder for construction, but new'ing ComponentModel instead.

Any objections to reverting this patch?

-- Roelof.

On Wed, Jul 9, 2008 at 3:12 PM, <notification@...> wrote:

User: enix
Date: 2008/07/09 06:12 AM

Modified:
 /trunk/InversionOfControl/Castle.MicroKernel/Registration/
 ComponentInstanceDescriptor.cs, ComponentRegistration.cs

Log:
 Better fix for the dependency exception that occurred when resolving a component instance that has c'tor arguments. This patch excluded the component from being inspected for registration. This allows the registration of Stub instanced generated by Rhino.Mocks.

File Changes:

Directory: /trunk/InversionOfControl/Castle.MicroKernel/Registration/
=====================================================================

File [modified]: ComponentInstanceDescriptor.cs
Delta lines: +0 -5
===================================================================
--- trunk/InversionOfControl/Castle.MicroKernel/Registration/ComponentInstanceDescriptor.cs     2008-07-08 20:49:29 UTC (rev 5221)
+++ trunk/InversionOfControl/Castle.MicroKernel/Registration/ComponentInstanceDescriptor.cs     2008-07-09 13:12:54 UTC (rev 5222)
@@ -30,11 +30,6 @@
               {
                       model.CustomComponentActivator = typeof(ExternalInstanceActivator);
                       model.ExtendedProperties["instance"] = instance;
-
-                       // The constructor collection is filled because the instance gets inspected
-                       // by the kernel when added. The kernel doesn't need to resolve any
-                       // dependencies since we pass an instance.
-                       model.Constructors.Clear();
               }
       }
 }
\ No newline at end of file

File [modified]: ComponentRegistration.cs
Delta lines: +9 -4
===================================================================
--- trunk/InversionOfControl/Castle.MicroKernel/Registration/ComponentRegistration.cs   2008-07-08 20:49:29 UTC (rev 5221)
+++ trunk/InversionOfControl/Castle.MicroKernel/Registration/ComponentRegistration.cs   2008-07-09 13:12:54 UTC (rev 5222)
@@ -37,6 +37,7 @@
       {
               private String name;
               private bool overwrite;
+               private bool isInstanceRegistration;
               private Type serviceType;
               private Type implementation;
               private List<Type> forwardedTypes = new List<Type>();
@@ -159,6 +160,7 @@
                               throw new ArgumentNullException("instance");
                       }

+                       isInstanceRegistration = true;
                       ImplementedBy(instance.GetType());
                       return AddDescriptor(new ComponentInstanceDescriptior<S>(instance));
               }
@@ -504,12 +506,15 @@
                                       descriptor.ApplyToConfiguration(kernel, configuration);
                               }

-                               if (componentModel == null)
+                               if (componentModel == null && isInstanceRegistration == false)
                               {
-                                       componentModel = kernel.ComponentModelBuilder.BuildModel(
-                                               name, serviceType, implementation, null);
+                    componentModel = kernel.ComponentModelBuilder.BuildModel(name, serviceType, implementation, null);
+                               }
+                               else if (componentModel == null && isInstanceRegistration)
+                               {
+                                       componentModel = new ComponentModel(name, serviceType, implementation);
                               }
-
+
                               foreach (ComponentDescriptor<S> descriptor in descriptors)
                               {
                                       descriptor.ApplyToModel(kernel, componentModel);

















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


Re: [enix commit: 5222]: /trunk/InversionOfControl/Castle.MicroKernel/Registration/

by Craig Neuwirt :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I know.  I couldn't find anything either.  At least I believe I know what they want to i'll try and fix it up.

Thanks for tracking this one.
craig

On Thu, Jul 24, 2008 at 9:01 AM, Roelof Blom <roelof.blom@...> wrote:
Don't know, I've searched the list but could not find any related discussions. Adding the fact there's no failing test case either it's hard to tell what the original problem was.


On Thu, Jul 24, 2008 at 3:12 PM, Craig Neuwirt <cneuwirt@...> wrote:
Yeah.  In particular the first patch that performed the constructor clear.


On Thu, Jul 24, 2008 at 7:43 AM, Roelof Blom <roelof.blom@...> wrote:
Do you mean what this patch was supposed to fix?


On Thu, Jul 24, 2008 at 2:04 PM, Craig Neuwirt <cneuwirt@...> wrote:
Do you know exactly what the original problem was that caused the initial changes?


On Wed, Jul 23, 2008 at 4:59 PM, Roelof Blom <roelof.blom@...> wrote:
Hi,

This breaks the Wcf facility (and probably more stuff, but I'm not sure). For instance, in Wcf facility there's no service metadata available because ComponentModel.Configuration is never set, causing WcfUtils.FindBehaviors<> to never find any IServiceBehavior handlers.

I think that the problem is that ComponentRegistration is not using ComponentModelBuilder for construction, but new'ing ComponentModel instead.

Any objections to reverting this patch?

-- Roelof.

On Wed, Jul 9, 2008 at 3:12 PM, <notification@...> wrote:

User: enix
Date: 2008/07/09 06:12 AM

Modified:
 /trunk/InversionOfControl/Castle.MicroKernel/Registration/
 ComponentInstanceDescriptor.cs, ComponentRegistration.cs

Log:
 Better fix for the dependency exception that occurred when resolving a component instance that has c'tor arguments. This patch excluded the component from being inspected for registration. This allows the registration of Stub instanced generated by Rhino.Mocks.

File Changes:

Directory: /trunk/InversionOfControl/Castle.MicroKernel/Registration/
=====================================================================

File [modified]: ComponentInstanceDescriptor.cs
Delta lines: +0 -5
===================================================================
--- trunk/InversionOfControl/Castle.MicroKernel/Registration/ComponentInstanceDescriptor.cs     2008-07-08 20:49:29 UTC (rev 5221)
+++ trunk/InversionOfControl/Castle.MicroKernel/Registration/ComponentInstanceDescriptor.cs     2008-07-09 13:12:54 UTC (rev 5222)
@@ -30,11 +30,6 @@
               {
                       model.CustomComponentActivator = typeof(ExternalInstanceActivator);
                       model.ExtendedProperties["instance"] = instance;
-
-                       // The constructor collection is filled because the instance gets inspected
-                       // by the kernel when added. The kernel doesn't need to resolve any
-                       // dependencies since we pass an instance.
-                       model.Constructors.Clear();
               }
       }
 }
\ No newline at end of file

File [modified]: ComponentRegistration.cs
Delta lines: +9 -4
===================================================================
--- trunk/InversionOfControl/Castle.MicroKernel/Registration/ComponentRegistration.cs   2008-07-08 20:49:29 UTC (rev 5221)
+++ trunk/InversionOfControl/Castle.MicroKernel/Registration/ComponentRegistration.cs   2008-07-09 13:12:54 UTC (rev 5222)
@@ -37,6 +37,7 @@
       {
               private String name;
               private bool overwrite;
+               private bool isInstanceRegistration;
               private Type serviceType;
               private Type implementation;
               private List<Type> forwardedTypes = new List<Type>();
@@ -159,6 +160,7 @@
                               throw new ArgumentNullException("instance");
                       }

+                       isInstanceRegistration = true;
                       ImplementedBy(instance.GetType());
                       return AddDescriptor(new ComponentInstanceDescriptior<S>(instance));
               }
@@ -504,12 +506,15 @@
                                       descriptor.ApplyToConfiguration(kernel, configuration);
                               }

-                               if (componentModel == null)
+                               if (componentModel == null && isInstanceRegistration == false)
                               {
-                                       componentModel = kernel.ComponentModelBuilder.BuildModel(
-                                               name, serviceType, implementation, null);
+                    componentModel = kernel.ComponentModelBuilder.BuildModel(name, serviceType, implementation, null);
+                               }
+                               else if (componentModel == null && isInstanceRegistration)
+                               {
+                                       componentModel = new ComponentModel(name, serviceType, implementation);
                               }
-
+
                               foreach (ComponentDescriptor<S> descriptor in descriptors)
                               {
                                       descriptor.ApplyToModel(kernel, componentModel);




















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


Re: [enix commit: 5222]: /trunk/InversionOfControl/Castle.MicroKernel/Registration/

by Roelof Blom :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Cool. Are you planning on fixing this momentarily?

On Thu, Jul 24, 2008 at 4:09 PM, Craig Neuwirt <cneuwirt@...> wrote:
I know.  I couldn't find anything either.  At least I believe I know what they want to i'll try and fix it up.

Thanks for tracking this one.
craig


On Thu, Jul 24, 2008 at 9:01 AM, Roelof Blom <roelof.blom@...> wrote:
Don't know, I've searched the list but could not find any related discussions. Adding the fact there's no failing test case either it's hard to tell what the original problem was.


On Thu, Jul 24, 2008 at 3:12 PM, Craig Neuwirt <cneuwirt@...> wrote:
Yeah.  In particular the first patch that performed the constructor clear.


On Thu, Jul 24, 2008 at 7:43 AM, Roelof Blom <roelof.blom@...> wrote:
Do you mean what this patch was supposed to fix?


On Thu, Jul 24, 2008 at 2:04 PM, Craig Neuwirt <cneuwirt@...> wrote:
Do you know exactly what the original problem was that caused the initial changes?


On Wed, Jul 23, 2008 at 4:59 PM, Roelof Blom <roelof.blom@...> wrote:
Hi,

This breaks the Wcf facility (and probably more stuff, but I'm not sure). For instance, in Wcf facility there's no service metadata available because ComponentModel.Configuration is never set, causing WcfUtils.FindBehaviors<> to never find any IServiceBehavior handlers.

I think that the problem is that ComponentRegistration is not using ComponentModelBuilder for construction, but new'ing ComponentModel instead.

Any objections to reverting this patch?

-- Roelof.

On Wed, Jul 9, 2008 at 3:12 PM, <notification@...> wrote:

User: enix
Date: 2008/07/09 06:12 AM

Modified:
 /trunk/InversionOfControl/Castle.MicroKernel/Registration/
 ComponentInstanceDescriptor.cs, ComponentRegistration.cs

Log:
 Better fix for the dependency exception that occurred when resolving a component instance that has c'tor arguments. This patch excluded the component from being inspected for registration. This allows the registration of Stub instanced generated by Rhino.Mocks.

File Changes:

Directory: /trunk/InversionOfControl/Castle.MicroKernel/Registration/
=====================================================================

File [modified]: ComponentInstanceDescriptor.cs
Delta lines: +0 -5
===================================================================
--- trunk/InversionOfControl/Castle.MicroKernel/Registration/ComponentInstanceDescriptor.cs     2008-07-08 20:49:29 UTC (rev 5221)
+++ trunk/InversionOfControl/Castle.MicroKernel/Registration/ComponentInstanceDescriptor.cs     2008-07-09 13:12:54 UTC (rev 5222)
@@ -30,11 +30,6 @@
               {
                       model.CustomComponentActivator = typeof(ExternalInstanceActivator);
                       model.ExtendedProperties["instance"] = instance;
-
-                       // The constructor collection is filled because the instance gets inspected
-                       // by the kernel when added. The kernel doesn't need to resolve any
-                       // dependencies since we pass an instance.
-                       model.Constructors.Clear();
               }
       }
 }
\ No newline at end of file

File [modified]: ComponentRegistration.cs
Delta lines: +9 -4
===================================================================
--- trunk/InversionOfControl/Castle.MicroKernel/Registration/ComponentRegistration.cs   2008-07-08 20:49:29 UTC (rev 5221)
+++ trunk/InversionOfControl/Castle.MicroKernel/Registration/ComponentRegistration.cs   2008-07-09 13:12:54 UTC (rev 5222)
@@ -37,6 +37,7 @@
       {
               private String name;
               private bool overwrite;
+               private bool isInstanceRegistration;
               private Type serviceType;
               private Type implementation;
               private List<Type> forwardedTypes = new List<Type>();
@@ -159,6 +160,7 @@
                               throw new ArgumentNullException("instance");
                       }

+                       isInstanceRegistration = true;
                       ImplementedBy(instance.GetType());
                       return AddDescriptor(new ComponentInstanceDescriptior<S>(instance));
               }
@@ -504,12 +506,15 @@
                                       descriptor.ApplyToConfiguration(kernel, configuration);
                               }

-                               if (componentModel == null)
+                               if (componentModel == null && isInstanceRegistration == false)
                               {
-                                       componentModel = kernel.ComponentModelBuilder.BuildModel(
-                                               name, serviceType, implementation, null);
+                    componentModel = kernel.ComponentModelBuilder.BuildModel(name, serviceType, implementation, null);
+                               }
+                               else if (componentModel == null && isInstanceRegistration)
+                               {
+                                       componentModel = new ComponentModel(name, serviceType, implementation);
                               }
-
+
                               foreach (ComponentDescriptor<S> descriptor in descriptors)
                               {
                                       descriptor.ApplyToModel(kernel, componentModel);























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


Re: [enix commit: 5222]: /trunk/InversionOfControl/Castle.MicroKernel/Registration/