public static MapProvider FromDataRow(SqliteDataReader reader) { try { string serviceName = reader["mapProviderName"].ToString(); string baseURL = reader["baseURL"].ToString(); string[] urlParts = reader["urlParts"].ToString().Split("###"); string providerURL = baseURL; MapProviderAccessTypes type = (MapProviderAccessTypes)Enum.Parse(typeof(MapProviderAccessTypes), reader["type"].ToString()); int mapProviderID = int.Parse(reader["mapProviderID"].ToString()); // for each url part, combine it with the base url foreach (string part in urlParts.Reverse()) { providerURL += part; } var createdProvider = new MapProvider() { MapProviderID = mapProviderID, Name = serviceName, BaseURL = providerURL, AccessType = type }; return(createdProvider); } catch (Exception e) { Console.Error.WriteLine(e.Message + "\n" + e.StackTrace); return(null); } }
public MapProvider(int MapProviderID, string Name, string BaseURL, MapProviderAccessTypes AccessType) { this.MapProviderID = MapProviderID; this.Name = Name; this.BaseURL = BaseURL; this.AccessType = AccessType; }