开发者

Opennetcf IoC Calls my class's constructor twice

开发者 https://www.devze.com 2023-03-24 22:55 出处:网络
I have a class (named A) which uses another class (named B) as one of it\'s constructor\'s arguments by Openn开发者_开发知识库etcf\'s IoC Dependency Injection.

I have a class (named A) which uses another class (named B) as one of it's constructor's arguments by Openn开发者_开发知识库etcf's IoC Dependency Injection.

the problem is when my application starts , class B's constructor is called twice.

Class A's constructor :

[InjectionConstructor]
public MyService([CreateNew]ClassB classb)
{
    _classb = classb;
}

I also load Class B by the "Load" method in the RootWorkItem collection.

any helps appreciated


I dont know this IoC Framework but your'e telling it that a object must be injected by the framework and you also state that the ClassB class needs to be created. So maybe that cause class b constructor to be called twice ? Once with the injector attribite and once with the createNew Attribute

0

精彩评论

暂无评论...
验证码 换一张
取 消