I have two projects in the solution WCF and MVC. In the MVC project I use Ninject.Extensions.Wcf.Client . In both projects I use the interface Shop.Services.Abstract.IUserService
[ServiceContract(Name = "IUserService")] public interface IUserService { [OperationContract] UserBM Create(UserBM user, string password); [OperationContract] void Update(UserBM user, string pass = null, bool changePassword = false); [OperationContract] UserBM GetById(Guid id); [OperationContract] void Delete(UserBM user); [OperationContract] UserBM LogOn(string eMail, string pass); [OperationContract] List<UserBM> GetAllUsers(); }
When I create a 'service reference' in the MVC project, the service creates its own namespace Shop.Web.UserSeviceClient.IUserService, it turns out that my interfaces differ only in the namespace,
[System.Diagnostics.DebuggerStepThroughAttribute()] [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")] public partial class UserServiceClient : System.ServiceModel.ClientBase<Shop.Web.UserSeviceClient.IUserService>, Shop.Web.UserSeviceClient.IUserService { public UserServiceClient() { } public UserServiceClient(string endpointConfigurationName) : base(endpointConfigurationName) { } public UserServiceClient(string endpointConfigurationName, string remoteAddress) : base(endpointConfigurationName, remoteAddress) { } }
in order to use Ninject it is necessary that the interfaces are the same, therefore I cannot bind UserServiceClient ( Shop.Web.UserSeviceClient.IUserService
) to the Shop.Services.Abstract.IUserService
interface
private void AddBindings() { ninjectKernel.Bind<IUserService>().ToServiceChannel("BasicHttpBinding_IUserService"); }
Can anyone come across such a problem? help if not hard)