I have a service class :
public class MyService : IService
{
private IRepoA repoA;
private IRepoB repoB;
public MyService(IRepoA repoA,IRepoB repoB)
{
this.repoA=repoA;
this.repoB=repoB;
}
}
my Controller depends on the MyService classL
public MyController : DefaultController
{
IService myService;
public MyController(IService service)
{
myService=service;
}
}
how do I inject the MyService class into the controller ? should i do this ? :
Bind<IPostService>()
.To<PostService>();
Bind<IPostsRepository>()
.To<SqlPostsRepository>()
.WithConstructorArgument("connectionString",
ConfigurationManager.ConnectionStrings[0].ConnectionString);
Bind<IUserRepository>()
.To<FakeUserRepository>();