0

是否有可能自动注册所有在温莎城堡中实现某个接口的 TypedFactories?

我的界面如下所示:

Public Interface IViewModelFactory(Of TViewModel)

    Function Create() As TViewModel

    Sub Release(view As TViewModel)

End Interface

我尝试通过以下方式注册我的所有工厂:

container.Register(Classes _
                   .FromThisAssembly() _
                   .BasedOn(GetType(IViewModelFactory(Of ))) _
                   .WithServiceFromInterface() _
                   .Configure(Sub(o) o.AsFactory()))

但我的工厂都没有注册

谢谢

4

1 回答 1

1

use Types, not Classes,那些不是类而是接口。

于 2012-09-13T21:44:14.683 回答