Registering and Resolving a Service with delegate type constructor parameter using Structuremap

I have following service class:

public class MyService : IService
{
   public MyService(Func<string,bool> question)
   {
      ....
   }
   ...
}

When I use this service in my WinForms application I want to pass following code as MyService constructor parameter

(string question) => 
{ 
   var questionForm = new SimpleQuestionForm(question);
   if(questionForm.ShowDialog() == DialogResult.OK)
      return true;
   else
      return false; 
}

How can I tell to the StructureMap that what is my question delegate?



from Recent Questions - Stack Overflow https://ift.tt/3rFkCAB
https://ift.tt/eA8V8J

Comments

Popular posts from this blog

Spring Elasticsearch Operations

Hibernate Search - Elasticsearch with JSON manipulation

Today Walkin 14th-Sept