I'm using ASP.NET MVC 3 and have my custom model binder.
public class NewsModelBinder : DefaultModelBinder
{
private readonly INewsRepository newsRepository;
private readonly ICategoryRepository categoryRepository;
public NewsModelBinder()
{
}
public NewsModelBinder(INewsRepository newsRepository, ICategoryRepository categoryRepository)
{
this.newsRepository = newsRepository;
this.categoryRepository = categoryRepository;
}
protected override object CreateModel(ControllerContext controllerContext, ModelBindingContext bindingContext, Type modelType)
{
//Some code here
}
}
And i want to resolve dependencies with Castle Windsor. But which way i can do this if i want to both register my binder and i want Windsor to give it required parametres? Because when i register binder I can't just give it needed parametres.
UPD 0 Or, maybe, I can get suitable objects from container in code? Because i register these repositories as singletones.