Hi,

 

Interesting – it does indeed! I didn’t think of that myself, because we
never (and I mean really never – 0% of the time) use .ctor-based injection.
Instead, we use property-based injection with our own [Inject] and
[InjectOptionally] attributes, which does just what you would expect them
to do… :-)

 

It would be quite interesting to see if this is because of a limitation in
the SL .NET runtime, or if it’s something that can be worked around. I
think it’s nice to be able to let our services be “internal”, but if that
makes the injection silently fail, it’s no so nice of course. Please, check
it out if you like. (Do you want me to make a bug report for this also?)

 

(So, the answer to your second question is implicity “yes” also.)

 

Best regards,

Per

 

From: [email protected]
[mailto:[email protected]] On Behalf Of Krzysztof
Kozmic
Sent: den 16 februari 2012 14:29
To: [email protected]
Subject: Re: Properties in an internal class not being injected, even
though the class is public

 

Hi Per,

that indeed is "interesting". Can't say from the top of my head I can see
any reason for it to do it.
If you make it a .ctor dependency does it work?

Also, I know stupid question, but did you register IWindsorContainer in the
container? It's not available by default...

@K

On 16/02/2012 10:23 PM, Lundberg, Per wrote: 

Hi!

Ive seen an interesting issue lately which affects how properties get
injected. My registration looks like this (I have to use AllTypes.* rather
than Component.* because Im calling a configuration method to help out with
the configuration, and I couldnt get that working with the Component.*
approach):

windsorContainer.Register(AllTypes

.From(type)

.Pick()

.LifestyleSingleton()

.Configure(c => c.ConfigurePropertyInjection()));

The ConfigurePropertyInjection method basically calls .Properties() with a
predicate, to make certain properties be included as mandatory, and others
included as optional, based on a customer attribute in our application
framework.

The class being registered looks like this:

internal sealed class InternalEntitiesInitializer :
IAutoInitializedComponent

{

/// <summary>

/// The Windsor IoC container.

/// </summary>

[Inject]

public Castle.Windsor.IWindsorContainer WindsorContainer { get; set; }

Now, the really interesting thing This works, when running with WPF. The
WindsorContainer get injected. But with Silverlight, it doesnt. I presume
its because the class is internal, but the thing is that I have the
InternalsVisibleTo assembly property set up so that it should work. And I
mean, it finds the type (when registering it), so why on earth does it
ignore its properties? J

Thanks in advance for any help with this.

Best regards,

-- -- -- -- -- -- -- --

PER LUNDBERG Software Engineer
[email protected] <mailto:[email protected]> www.ecraft.com
<http://www.ecraft.com/> 

tel. +358 (0) 20 759 8687

eCraft Oy Ab, Wolffskavgen 36, FI-65200 Vasa

-- 
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.

 

-- 
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.

-- 
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