I have a class ScreenParameter (implement IScreenParameter) that stores all form values in windows form. This class is initiated when user populate all the fields and click the button. The class in Bussiness Layer waits IScreenParameter in its constructor. I am using Structure map to inject the interface and it needs to be created on its context. I have a method(GetScreenParameters) that creates and populates the interface. I want to give method name instead of concreate class while configuring Structure map and tried this.
ObjectFactory.Initialize(initialize =>
{
initialize.For<IScreenParameter>().Use(GetScreenParameters);
});
But it is not working. Can you please help how to achieve this?