I have an interface, called IRepository, with two implementations:
SqlRepository
SqlDualWriter
第一项执行工作是定期实施T类物体。 它依赖SqlConnectionStringProvider(提供联系人,如名称所示,并作为建筑参数,使用一个显示姓名的链接)。
第二项是另一项在内部使用两种储存地:
public class SqlDualWriter<T> : IRepository<T>
{
private readonly IRepository<T> _primaryRepository;
private readonly IRepository<T> _secondaryRepository;
public SqlDualWriter(
IRepository<T> primaryRepository,
IRepository<T> secondaryRepository)
{
_primaryRepository = primaryRepository;
_secondaryRepository = secondaryRepository;
iii
iii
我想要实现的是组合结构,以便在要求进行保存时,它将:
- resolve IRepository to an instance of SqlDualWriter
- resolve the two inner repositories to type SqlRepository
- for the two SqlRepository objects instantiated at step 2 I need to resolve the SqlConnectionStringProvider in a different way (providing different string parameters in the constructor)
I have no idea how to achieve this. Is there a way to do it with Attributes or other types of configuration?
I m 采用结构Map 2.6.2.0。