One samll tip on IOC.resolve

We use unity as our IOC container. It’s our first time to use this tool, so we meet a little problem when we call the resolve<>() method.

Create Instance Exception

Often, the IOC throw an exception for cannot resolve the class, please check the configuration.

So we check the configuration file very carefully, but find nothing is wrong.

At last, we find that we need to add the reference which contains the instance class to the project. As we use the DI, so the project cannot know which project or assembly you need to include.

Conclusion

We need to write the error message more carefully for others to understand.

Also, do not full trust other’s error message for every guy is not God, allow mistake for them.

So, enjoy the Unity!

你可能感兴趣的:(IOC)