Jorge,
I've got a feeling we're not on the same page here.
If all you want is to be explicit you want a non-default IMyService
injected into your ProductController than just doing serviceoverride
with default activator should do it.
Why are you using custom activator again?
Krzysztof
On 2010-04-13 16:50, jorge.rowies wrote:
First of all, I feel that I have to make clear one point, I am a
completely newbie at Castle, so please forgive me for all the mistakes
I could make in the following sentences (and for my english) :P
I am currently working on a migration of a bunch of configurations
made in spring.net (xml) to Castle using Fluent API, and the code that
I am wiring is "almost" legacy code, so I have to lower to a minimum
the amount of changes to the existing code in this process of
migrating from spring.net to castle.
@John
About using DoNotWire attribute, I can't go that way for two reasons,
first, because of the legacy code issue I mentioned before and,
second, because that will "tie" my code to Castle.
@Krzysztof
I'm not sure if I understand, I have properties that I want to wire by
using ServiceOverride, like this:
container.Register(
Component.For<IMyService>()
.ImplementedBy<MyServiceImpl>()
.Named("myservice.default"),
Component.For<IMyService>()
.ImplementedBy<OtherServiceImpl>()
.Named("myservice.alternative"),
Component.For<ProductController>()
.ServiceOverrides(ServiceOverride.ForProp(p =>
p.MyService).Eq("myservice.alternative")) //<-- here I am using this
extensions
http://using.castleproject.org/display/IoC/Strongly+Typed+property+wiring+with+Fluent+Registration+API
);
public class ProductController
{
public IMyService MyService {get;set;}
public ProductController()
{
}
}
But I don't want MyService property to be auto-wired.
If I remove the setter of MyService property, this could be achieved?
Thanks a lot John and Krzysztof
Jorge
On 12 abr, 19:08, Krzysztof Koźmic<[email protected]> wrote:
why do you have the properties settable if you don't want to set them?
2010/4/12 jorge.rowies<[email protected]>:
Hello, Roelof Blom said in the last post of this thread:
http://groups.google.com/group/castle-project-users/browse_thread/thr...
That one way of disabling property auto-wiring could be achieved with
something like this:
container.Register(Component
.For(impl) .LifeStyle.Transient)
.Activator<MyModelActivator>()
class MyModelActivator: DefaultComponentActivator
{
protected override void SetUpProperties(object instance,
CreationContext
context)
{
// Do not auto-wire
}
}
Which worked great for me, but now I am having problems using
ServiceOverrides to set dependencies on a property, and I think it is
because of this custom activator.
Is there any way to prevent property auto wiring and still be able to
use ServiceOverrides?
Thanks a lot
--
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
athttp://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.