0

We are migrating from .aspx web application to MVC app.

Below is the problem while migrating:

I have a third party dll which contains static factory method to return instance by given Interface name.

Controller code:

IBus objBus = (IBus) ObjectFactory.GetInstance("IBus") as IBus;

Here, ObjectFactory is from third party dll with definition as below (no more code details are available on GetInstance method).

public class ObjectFactory
{
    public ObjectFactory();
    public static object GetInstance(string interfaceName);
}

GetInstance method works perfectly in .aspx application - objBus is created successfully. But the same line (Controller code) when executed in MVC controller returns objBus as null.

Please suggest what could be the problem. I guess it may be due to difference in architecture and/or page life cyle of .aspx and mvc apps. Any suggestions on the problem are greatly appreciated.

4

1 に答える 1