I am using Unity to resolve a repository that requires two factory classes in the parameter. Below is my repository constructor:
//repo constructor
public MyRepo(IChannelClientFactory<IRemotedVisitorChat> chatFactory, IChannelClientFactory<IRemotedVisitorWebsite> siteFactory )
{
ChatFactory = chatFactory;
SiteFactory = siteFactory;
}
ChatFactory and SiteFactory are of type class RemotingClientFactory<T> : IChannelClientFactory<T> that has a contructor of:
RemotingClientFactory(string endpointName)
before, RemotingClientFactory had a parameterless constructor, but in doing some refactoring, I added the string endpointName.
I was registering my repository like this:
container.RegisterType<IMyRepo, MyRepo>(new HierarchicalLifetimeManager(), new InjectionConstructor(typeof (RemotingClientFactory)));
originally, there was only one parameter for MyRepo constructor and RemotingClientFactory didn't take any arguments for its constructor
I am getting lost in the weeds reading the Unity docs. How can I provide RemotingClientFactory with an initialization string?
InjectionFactoryapproach?ChatFactoryandSiteFactoryeach classes derived fromRemotingClientFactory<IRemotedVisitorChat>andRemotingClientFactory<IRemotedVisitorWebsite>respectively?