考慮添加參數Platform
構造函數,像它在DbContext
public interface IPlatform
{
...
}
public abstract class Platform : IPlatform
{
public Platform(string connString , string filePath)
{
...
}
}
public sealed class Platform1 : Platform
{
public Platform1(string connString, string filePath) : base(connString, filePath) {}
}
public interface IPlatformFactory
{
IPlatform GetPlatform(string code, string connString, string filePath);
}
public class PlatformFactory : IPlatformFactory
{
public IPlatform GetPlatform(string code, string connString, string filePath)
{
...
return new Platform1(connString, filePath);
}
}
誰(什麼對象)擁有這些信息? – 2014-11-03 19:29:29
配置信息由MVC應用程序擁有 – user3700866 2014-11-03 19:30:13
全局應用程序類? – 2014-11-03 19:41:52