public IBugDatabaseProvider Load(string path, IEnumerable <string> args, IWebRequest webRequest) { _Assembly dll = bugDatabaseFactory.LoadFile(path); IEnumerable <Type> validTypes = dll.GetExportedTypes().Where((type) => typeof(IBugDatabaseProvider).IsAssignableFrom(type)); if (!validTypes.Any()) { throw new Exception($"Dll must contain a public implementation of '{typeof(IBugDatabaseProvider)}'"); } else if (validTypes.Count() > 1) { throw new Exception($"Dll can only contain one public implementation of '{typeof(IBugDatabaseProvider)}'. Found {validTypes.Count()}"); } IBugDatabaseProvider databaseProvider = bugDatabaseFactory.CreateInstance(validTypes.First()); databaseProvider.Logger = logger; databaseProvider.WebRequest = webRequest; if (databaseProvider.ProcessArgs(args) != 0) { throw new Exception("Unable to parse Dll arguments. Check requirements"); } return(databaseProvider); }
public DBVersionRepository AddVersions(_Assembly ass) { m_log.Debug(string.Format("Importing methods from assembly {0}", ass.FullName)); foreach (Type type in ass.GetExportedTypes()) { if (Minder.Engine.AttributeParser.GetAttribute <DBHistoryAttribute>(type) == null) { continue; } AddVersions(type); } return(this); }
public DBVersionRepository AddVersions(_Assembly ass) { m_log.Debug(string.Format("Importing methods from assembly {0}", ass.FullName)); foreach (Type type in ass.GetExportedTypes()) { if (Minder.Engine.AttributeParser.GetAttribute<DBHistoryAttribute>(type) == null) continue; AddVersions(type); } return this; }