private static BaseAccount Create(string name, string type, IDictionary <string, string> options, BaseAccount account) { string clazzName = "F2B.processors." + type + "Account"; Type clazzType = Type.GetType(clazzName); if (clazzType == null) { Log.Error("AccountManager::Create(" + name + ", " + type + ", ...) unable to resolve account class \"" + clazzName + "\""); } else { Log.Info("AccountManager::Create(" + name + ", " + type + ", ...) resolved account class \"" + clazzName + "\""); } if (typeof(ICacheAccount).IsAssignableFrom(clazzType)) { ConstructorInfo ctor = clazzType.GetConstructor( new[] { typeof(string), typeof(IDictionary <string, string>), typeof(ICachableAccount) }); return((BaseAccount)ctor.Invoke(new object[] { name, options, account })); } else { ConstructorInfo ctor = clazzType.GetConstructor( new[] { typeof(string), typeof(IDictionary <string, string>) }); return((BaseAccount)ctor.Invoke(new object[] { name, options })); } }
private static BaseAccount Create(string name, string type, IDictionary<string, string> options, BaseAccount account) { string clazzName = "F2B.processors." + type + "Account"; Type clazzType = Type.GetType(clazzName); if (clazzType == null) { Log.Error("AccountManager::Create(" + name + ", " + type + ", ...) unable to resolve account class \"" + clazzName + "\""); } else { Log.Info("AccountManager::Create(" + name + ", " + type + ", ...) resolved account class \"" + clazzName + "\""); } if (typeof(ICacheAccount).IsAssignableFrom(clazzType)) { ConstructorInfo ctor = clazzType.GetConstructor( new[] { typeof(string), typeof(IDictionary<string, string>), typeof(ICachableAccount) }); return (BaseAccount)ctor.Invoke(new object[] { name, options, account }); } else { ConstructorInfo ctor = clazzType.GetConstructor( new[] { typeof(string), typeof(IDictionary<string, string>) }); return (BaseAccount)ctor.Invoke(new object[] { name, options }); } }