DryIoc 中的多个 autofac .As<T>() 等价于什么?
What is the equivalent to multiple autofac .As<T>() in DryIoc?
从 Autofac 切换到 DryIoc 时,我需要实现类似于 .As<IService1>().As<IService2>()
的东西。
鉴于以下 class
public interface IService1
{
void DoStuff {}
}
public interface IService2
{
void DoThings {}
}
public class SomeService : IService1, IService2
{
public void DoStuff() {}
public void DoThings() {}
}
我的 autofac 注册看起来像这样
builder.RegisterType<SomeService>()
.As<IService1>()
.As<IService2>()
.SingleInstance();
在 DryIoc 中,这相当于什么?
RegisterMany
或 RegisterMapping
是它。这是 docs.
从 Autofac 切换到 DryIoc 时,我需要实现类似于 .As<IService1>().As<IService2>()
的东西。
鉴于以下 class
public interface IService1
{
void DoStuff {}
}
public interface IService2
{
void DoThings {}
}
public class SomeService : IService1, IService2
{
public void DoStuff() {}
public void DoThings() {}
}
我的 autofac 注册看起来像这样
builder.RegisterType<SomeService>()
.As<IService1>()
.As<IService2>()
.SingleInstance();
在 DryIoc 中,这相当于什么?
RegisterMany
或 RegisterMapping
是它。这是 docs.