First of all, I have never seen an example of using ninject with wcf.
This is my .svc:
<%@ ServiceHost Language="C#" Debug="true" Service="MyService.Services.NotifyService" %>
My Service:
[ServiceContract]
public interface INotifyService
{
[OperationContract]
void SendEmail(string to, string from, string message);
}
class NotifyService : INotifyService
{
private IEmailRepository emailRepo;
public NotifyService(IEmailRepository emailRepo)
{
if (emailRepo== null) throw new ArgumentNullException("emailRepo");
this.emailRepo= emailRepo;
}
public void SendEmail(string to, string from, string message)
{
//do stuff here
}
}
Using this information, how do I dependency inject MyEmailRepository
in NotifyService
?
If I do not have a default constructor, wcf throws an error asking for one. I also have experience using ninject with asp.net mvc3 if that helps.