internal DataStoreEntry(IDataStore dataStore, DataStoreMode mode, string prefix, bool deletePrefix)
 {
     DataStore    = dataStore;
     Mode         = mode;
     Prefix       = prefix;
     DeletePrefix = deletePrefix;
 }
        private DataStoreEntry GetDataStoreEntry(BaseStatement statement, DataStoreMode mode)
        {
            if (entries.Count == 1)
            {
                return(entries[0]);
            }
            var tables = GetTables(statement);

            var dataStores = tables.Select(GetDataStoreEntry).Distinct().ToArray();

            if (dataStores.Length == 1)
            {
                var result = dataStores[0];
                if (result.Mode < mode)
                {
                    throw new InvalidOperationException($"Mode {mode} not allowed on data store {result.DataStore}");
                }
                return(result);
            }

            string joinedNames = string.Join(", ", tables.Select(t => t.Name));

            if (dataStores.Length == 0)
            {
                throw new InvalidOperationException($"No data stores found for tables: {joinedNames}");
            }

            throw new InvalidOperationException($"Multiple data stores found in sinlge statement. Tables: {joinedNames}");
        }
        internal static string ToSerializedValue(this DataStoreMode value)
        {
            switch (value)
            {
            case DataStoreMode.Mount:
                return("Mount");

            case DataStoreMode.Download:
                return("Download");

            case DataStoreMode.Upload:
                return("Upload");
            }
            return(null);
        }
 public void AddDataStore(IDataStore dataStore, DataStoreMode mode, string prefix, bool deletePrefix)
 {
     entries.Add(new DataStoreEntry(dataStore, mode, prefix, deletePrefix));
 }
 public MixedDataStore(IDataStore dataStore, DataStoreMode mode)
 {
     AddDataStore(dataStore, mode, string.Empty, false);
 }
 public void AddConnectionString(string connectionString, string prefix, bool removePrefix, DataStoreMode mode)
 {
     entries.Add(new ConnectionStringEntry(connectionString, prefix, removePrefix, mode));
 }
 internal ConnectionStringEntry(string connectionString, string prefix, bool removePrefix,
                                DataStoreMode mode) : base(prefix, removePrefix, mode)
 {
     ConnectionString = connectionString;
 }
Beispiel #8
0
 protected DataStoreEntryBase(string prefix, bool removePrefix, DataStoreMode mode)
 {
     Prefix       = prefix;
     DeletePrefix = removePrefix;
     Mode         = mode;
 }