RegisterType by string(AssemblyQualifiedName)

26 views
Skip to first unread message

keinan....@gmail.com

unread,
Apr 12, 2017, 7:31:48 PM4/12/17
to Autofac
hi,
i am trying to do something like this:
...
foreach (var item in Dependencies)
{
_builder.RegisterType<item.ToType>().As<item.FromType>();
}
...
when item is :

public class Dependency
{
public Type FromType { get; set; }

public Type ToType { get; set; }
}

I know that i am doing it wrong, what i am trying to do is load the dependency
from remote provider.

Alex Meyer-Gleaves

unread,
Apr 12, 2017, 9:38:31 PM4/12/17
to Autofac
Hi Keinan,

There are non-generic versions of the RegisterType and As methods that you can use.

builder.RegisterType(item.ToType).As(item.FromType);

Cheers,

Alex.

keinan mendelis

unread,
Apr 13, 2017, 2:34:51 PM4/13/17
to Autofac
Thanks
Reply all
Reply to author
Forward
0 new messages