2

I have a WCF service with InstanceContextMode set to single

then Ninject 2.2 can not support it.

and Ninject 2.3 is still beta, if I use it, my Ninject 2.2 code in global.asax can't work with Ninject 2.3 library

Can anyone/Ninject Author give an example on using Ninject 2.3?

Or should I switch to other IoC?

[Edit] forgot to say. I don't have a default constructor for my service class, and so it will result in this error:

The service type provided could not be loaded as a service because it does not have a default (parameter-less) constructor. To fix the problem, add a default constructor to the type, or pass an instance of the type to the host.

Li Tian Gong
  • 393
  • 1
  • 6
  • 16

1 Answers1

2

Ninject 2.2 supports single instance services. Have a look at the examples on github: https://github.com/ninject/ninject.extensions.wcf/tree/Maintenance_2.2/src/Examples

Remo Gloor
  • 32,665
  • 4
  • 68
  • 98
  • Sorry,forgot to say it's about this error: I don't have a default constructor for my service. In this case, does Ninject 2.2 still work? The service type provided could not be loaded as a service because it does not have a default (parameter-less) constructor. To fix the problem, add a default constructor to the type, or pass an instance of the type to the host. – Li Tian Gong Dec 05 '11 at 22:40
  • In that case yi have to use 2.3, See https://github.com/ninject/ninject.extensions.wcf/tree/master/src/Examples for examples – Remo Gloor Dec 06 '11 at 00:31