0

I currently use this method for assigning topic names:

void SetTopicNames(IServiceBusBusFactoryConfigurator cfg)
{
    cfg.Message<IExampleMessage>(x => x.SetEntityName("ExampleTopic"));
}

I want to call the .Message function with types that are only known at runtime, so something like this:

void SetTopicNames(IServiceBusBusFactoryConfigurator cfg)
{
    var messageType = typeof(IExampleMessage);
    cfg.Message(messageType, x => x.SetEntityName("ExampleTopic"));
}

But there doesn't appear to be such a function.

How can I achieve this?

Neil
  • 9,926
  • 2
  • 23
  • 46
  • You can use reflection to build a generic method delegate at runtime https://stackoverflow.com/questions/232535/how-do-i-use-reflection-to-call-a-generic-method – Creyke Mar 18 '22 at 16:53

0 Answers0