Frage

Ich erhalte eine Ausnahme Aufruf Resolve:

KernelException: Could not instantiate custom activator
Inner Exception:
{"Constructor on type 'MyProj.MyAdapter`1[[MyProj.MyBusinessObject, MyAsm, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]' not found."}

Es gibt definitiv einen öffentlichen parameterlosen Konstruktor gibt (und ich dies mit Reflexion zur Laufzeit überprüft haben) ... so dass ich, das Problem könnte mit der Tatsache zu tun haben, dass es Generika? Ich habe versucht, das Komponentenmodell Objekt bekommen und RequiresGenericArguments auf true setzen, aber das hat mich nicht überall bekommen.

Jede Hilfe wäre sehr geschätzt! Danke.

War es hilfreich?

Lösung

Windsor ist nicht Standardkonstruktor instanziiert werden Aktivatoren verwendet wird.

Die neue Version führt eine hilfreiche Ausnahmemeldung:

Castle.MicroKernel.KernelException : Could not instantiate custom activator
  ----> System.ArgumentException : Type Castle.Windsor.Tests.ActivatorWithoutCorrectConstructor does not have a public constructor matching arguments of the following types:
Castle.Core.ComponentModel
Castle.MicroKernel.DefaultKernel
Castle.MicroKernel.ComponentInstanceDelegate
Castle.MicroKernel.ComponentInstanceDelegate

Sie müssen also einen Konstruktor wie folgt

public YourActivator(ComponentModel model, IKernel kernel,
                                    ComponentInstanceDelegate onCreation,
                                    ComponentInstanceDelegate onDestruction)
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top