Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inject from another class library? #7

Open
Tyre88 opened this issue Oct 20, 2017 · 3 comments
Open

Inject from another class library? #7

Tyre88 opened this issue Oct 20, 2017 · 3 comments

Comments

@Tyre88
Copy link

Tyre88 commented Oct 20, 2017

Hello,

I am trying to inject from another class library but it doesn't work, i am getting this error:
Couldn't resolve type 'BLL.UserBLL, MyProject.Core' defined in 'to' attribute.

XML:

<module name="MyModule">
  <bind service="IUserBLL, MyWebProject"
        to="BLL.UserBLL, MyProject.Core" name="UserBLL" />
</module>

So i am trying to use the class UserBLL in the namespace "BLL" in the external class library "MyProject.Core".

The MyProject.Core is refered in MyWebProject

What am i doing wrong?

@scott-xu
Copy link
Member

Did you forget adding the namespace?

<bind service="MyWebProject.IUserBLL, MyWebProject"
        to="MyProject.Core.BLL.UserBLL, MyProject.Core" name="UserBLL" />

@Tyre88
Copy link
Author

Tyre88 commented Nov 7, 2017

No i didn't forget it, i've tried with and without... Nothing works.

@Tyre88
Copy link
Author

Tyre88 commented Nov 8, 2017

A extra note is that i can see the binding of i debug and inspect the kernel so the mapping is made correctly.
I try to inject into a webservice (asmx), i've changed the inheritance to Ninject.Web.WebServiceBase and i am putting the attribute [Inject] to the property that i want to inject.
All this works if i use kernel.Bind() instead with the same class and interface.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants