You can either us constructor injection:
public class TCFormModel
{
public TCFormModle(IPNConBut pConBut) {
this.pConBut = pConBut;
}
public string Name { get; set; }
public IPNConBut pConBut { get; set; }
}
(which is usually recommend) or property injection:
public class TCFormModel
{
public string Name { get; set; }
[Inject]
public IPNConBut pConBut { get; set; }
}
Also see: https://github.com/ninject/ninject/wiki/Injection-Patterns
And generally the wiki: https://github.com/ninject/ninject/wiki
Update:
I recommend using the https://github.com/ninject/ninject.extensions.factory extension.
Bind your factory interface as follows:
IBindingRoot.Bind<IPNConButFactory>().ToFactory();
Then, in TCFormModelBinder
inject the IPNConButFactory
and use it to create an instance. The Model should only need one constructor in case of constructor injection, or no (=default ctor) in case of property injection.
I'm not familiar with asp.net MVC so i'm not certain whether you can actuall inject something into TCFormModelBinder
but i would guess so. At any rate, if you can't, you need to access the IKernel
somehow and retrieve the factory from there.