Thanks. Isn't this where I tell it to inject NewsRepository for
On Dec 8, 12:46 am, Aaron Powell <
m...@aaron-powell.com> wrote:
> You want to use builder.RegisterType<NewsRepository>(). Use the
> builder.Register<T> method if you want to handle construction of the object
> a bit more custom, ie:
> builder.Register<NewsRepository>(x => new
> NewsRepository(SomeMethodToGetConfig(()).As<INewsRepository>()
>
> Aaron Powell
> Umbraco Ninja
>
>
http://www.aaron-powell.com|
http://twitter.com/slace| Skype:
> aaron.l.powell | MSN:
aaz...@hotmail.com
>
> On Wed, Dec 8, 2010 at 12:36 AM, bioluminescence <
brendan.v...@gmail.com>wrote:
>
> > Hi,
>
> > I am using MVC 2 and I am new to Autofac. I'm not sure what I am
> > doing wrong, I know it is something. I want to register my
> > controllers and repository.
>
> > My NewsController constructor receives an INewsRepository parameter.
> > NewsPository implements INewsRepository. How would I register this?
> > This is what I currently have (I know it is wrong):
>
> > var builder = new ContainerBuilder();
> > builder.RegisterControllers(Assembly.GetExecutingAssembly());
> > builder.Register<NewsRepository>().As<INewsRepository>().SingletonScoped();
>
> > The compiler error is: No overload for method 'Register' takes 0
> > arguments
>
> > I assume that I am doing it wrong in registering all the controllers
> > as once like I did seeing that the NewsController constructor requires
> > a parameter?
>
> > Please can someone help me with the correct code?
>
> > Thanks
> > Brendan
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Autofac" group.
> > To post to this group, send email to
aut...@googlegroups.com.
> > To unsubscribe from this group, send email to