inversion of control - How to get Castle Windsor to call parameterless constructor? -
I currently have a class that looks like this:
public class MyClass: IMyClass {public MyClass () {//}} Public MyClass (IMyRepository repository) {// ...}} I have registered IMyClass in my config file, But IMyRepository is not my intention to use Constructor for Windsor, which does not take any parameters, but I am getting this message:
The component 'MyClass' is not created Can In because it has Sbsidikrn dependence. MyClass is waiting for the following dependencies:
Services: - Namespace. The IMIrpositor which was not registered.
I found that the container will call the manufacturer with the most logic that can satisfy it, then why is it trying to call the consignor with a logic to not satisfy him? is?
Perhaps you are using the old version of Windsor ... it works fine for me :
[TestFixture] Public Square Windsor Tests {Public Interface ISOInterface {} Public Sector Entity {Public Ent ID {Received; Private set; } Public Essar () {ID = 1; } Public Essar (ISOM Interface S) {ID = 2; }} [Test] Public Zero Parameter () {var Container = New Windsor Container (); Container.AddComponent & LT; AService & gt; (); Var service = container Resolver & lt; ASACA & gt; (); Assurance Rykvall (1, service. Id); }}
Comments
Post a Comment