private TableSchema LoadTableSchema(string tableName) { IDatabaseSchemaLoader schemaLoader = GetSchemaLoader(); TableSchema tableSchema = schemaLoader.LoadTableSchema(Connection, tableName); return(tableSchema ?? throw new InvalidOperationException($"Could not get schema for table [{tableName}]. Table does not exists.")); }
private TableSchema LoadTableSchema(string tableName) { IDatabaseSchemaLoader schemaLoader = GetSchemaLoader(); TableSchema tableSchema = schemaLoader.LoadTableSchema(Connection, tableName); return(tableSchema ?? throw new InvalidOperationException(string.Format(Resources.QueryProviderCouldNotGetTableSchema, tableName))); }
/// <inheritdoc cref="IDatabaseSchemaLoader{T}.LoadTableSchema(T, string)"/> /// <exception cref="ArgumentNullException">Value of any parameter is <see langword="null"/>.</exception> /// <exception cref="ArgumentException"> /// <list type="bullet"> /// <item>Loader for connection type specified by <paramref name="connection"/> does not exist.</item> /// <item>Value of <paramref name="tableName"/> is empty string, or string containing only whitespace characters.</item> /// </list> /// </exception> public TableSchema LoadTableSchema(object connection, string tableName) { Check.NotNullOrWhiteSpace(tableName, nameof(tableName)); IDatabaseSchemaLoader loader = CheckConnectionAndGetLoader(connection); return(loader.LoadTableSchema(connection, tableName)); }
private IDatabaseSchemaLoader CheckConnectionAndGetLoader(object connection) { Check.NotNull(connection, nameof(connection)); IDatabaseSchemaLoader loader = GetLoader(connection); if (loader == null) { throw new ArgumentException(Resources.DatabaseSchemaLoader_UnsupportedConnectionType, nameof(connection)); } return(loader); }
private IDatabaseSchemaLoader CheckConnectionAndGetLoader(object connection) { Check.NotNull(connection, nameof(connection)); IDatabaseSchemaLoader loader = GetLoader(connection); if (loader == null) { throw new ArgumentException( string.Format(Resources.UnsupportedConnectionType, connection.GetType().FullName), nameof(connection)); } return(loader); }
/// <summary> /// Removes <paramref name="loader"/> from the list of loaders. /// </summary> /// <param name="loader">Specific database schema loader to be removed from the list.</param> public void RemoveSchemaLoader(IDatabaseSchemaLoader loader) { _loaders.Remove(loader); }
/// <summary> /// Adds <paramref name="loader"/> to the list of loaders. /// </summary> /// <param name="loader">Specific database schema loader.</param> /// <exception cref="ArgumentNullException">Value of <paramref name="loader"/> is <see langword="null"/>.</exception> public void AddSchemaLoader(IDatabaseSchemaLoader loader) { Check.NotNull(loader, nameof(loader)); _loaders.Add(loader); }
/// <inheritdoc cref="IDatabaseSchemaLoader{T}.LoadSchema(T)"/> /// <exception cref="ArgumentNullException">Value of <paramref name="connection"/> is <see langword="null"/>.</exception> /// <exception cref="ArgumentException"> /// Loader for connection type specified by <paramref name="connection"/> does not exist. /// </exception> public DatabaseSchema LoadSchema(object connection) { IDatabaseSchemaLoader loader = CheckConnectionAndGetLoader(connection); return(loader.LoadSchema(connection)); }
public LoaderInfo(IDatabaseSchemaLoader loader, ISchemaCacheKeyGenerator keyGenerator) { Loader = loader; KeyGenerator = keyGenerator; }
/// <summary> /// Vymaže zadaný <paramref name="loader"/> databázovej schémy. /// </summary> /// <param name="loader">Loader databázovej schémy, ktorý sa má vymazať.</param> public void RemoveSchemaLoader(IDatabaseSchemaLoader loader) { _loaders.Remove(_loaders.FirstOrDefault((linfo) => linfo.Loader == loader)); }
/// <summary> /// Pridá do keše <paramref name="loader"/> na načítavanie schémy databázy, spolu s generátorom kľúčov pre načítanú /// shému <paramref name="keyGenerator"/>. /// </summary> /// <param name="loader">Loader pre načítavanie schémy databázy.</param> /// <param name="keyGenerator">Generátor kľúča pre schému databázy. Databáza sa interne drží v keši pod vygenerovaným /// kľúčom.</param> /// <exception cref="ArgumentNullException">Hodnota <paramref name="loader"/> alebo <paramref name="keyGenerator"/> /// je <c>null</c>.</exception> public void AddSchemaLoader(IDatabaseSchemaLoader loader, ISchemaCacheKeyGenerator keyGenerator) { Check.NotNull(loader, nameof(loader)); Check.NotNull(keyGenerator, nameof(keyGenerator)); _loaders.Add(new LoaderInfo(loader, keyGenerator)); }