I have a class named DocumentRepository<T>
with constructor
DocumentDbRepository(IDocumentCollectionName collectionName)
Where IDocumentCollectionName can be
CollectionNameFromClassName<T>
or
CollectionNameFromString
And I am resolving this by
container.RegisterType(typeof(IDocumentDbRepository<ClassA>), typeof(DocumentDbRepository<ClassA>))
container.RegisterType(typeof(IDocumentDbRepository<ClassB>), typeof(DocumentDbRepository<ClassB>))
So far so good.
But now I want to resolve IDocumentCollectionName to either CollectionNameFromClassName or CollectionNameFromString depending on the Generic Type.
So if I have ClassA, I want IDocumentCollectionName to resolve to CollectionNameFromClassName<ClassA>
And if i have ClassB, I want IDocumentCollectionName to resolve to CollectionNameFromString with a string parameter value