diff --git a/src/LogicalHacking.ExtensionDsLab/SqlConnector.fs b/src/LogicalHacking.ExtensionDsLab/ExtensionCore.fs similarity index 68% rename from src/LogicalHacking.ExtensionDsLab/SqlConnector.fs rename to src/LogicalHacking.ExtensionDsLab/ExtensionCore.fs index 06d7f6d..f2919bf 100644 --- a/src/LogicalHacking.ExtensionDsLab/SqlConnector.fs +++ b/src/LogicalHacking.ExtensionDsLab/ExtensionCore.fs @@ -19,26 +19,8 @@ namespace LogicalHacking.ExtensionDsLab.Archive -open FSharp.Data.Sql -open System.IO - -module SqlConnector = - [] - let ConnectionStringName = @"ProductionExtensionDB" - [] - let ResolutionPath = __SOURCE_DIRECTORY__ + @"/../../packages/MySql.Data/lib/net452" - - // create a type alias with the connection string and database vendor settings - type ExtensionDbProvider = SqlDataProvider< - DatabaseVendor = Common.DatabaseProviderTypes.MYSQL, - ConnectionStringName = ConnectionStringName, - ResolutionPath = ResolutionPath, - IndividualsAmount = 500, - UseOptionTypes = true > - - type ExtensionDbType = ExtensionDbProvider.dataContext - - let getDownloads (ctx:ExtensionDbType) extid = +module ExtensionCore = + let getDownloads (ctx:MySqlConnector.ExtensionDbType) extid = query { for order in ctx.Extensions.Extension do where (order.Extid = extid) @@ -48,7 +30,7 @@ module SqlConnector = download.Value)) |> Seq.toArray - let getAllExtIds (ctx:ExtensionDbType) = + let getAllExtIds (ctx:MySqlConnector.ExtensionDbType) = query { for ext in ctx.Extensions.Extension do select ext.Extid diff --git a/src/LogicalHacking.ExtensionDsLab/ExtensionDsLab.fsx b/src/LogicalHacking.ExtensionDsLab/ExtensionDsLab.fsx index bf1f6f7..cd3b6d8 100644 --- a/src/LogicalHacking.ExtensionDsLab/ExtensionDsLab.fsx +++ b/src/LogicalHacking.ExtensionDsLab/ExtensionDsLab.fsx @@ -35,7 +35,7 @@ open System.Configuration [] module ScriptConfig= - open LogicalHacking.ExtensionDsLab.Archive.SqlConnector + open LogicalHacking.ExtensionDsLab.Archive.MySqlConnector let connectionStringOrDefault ctx = let map = new ExeConfigurationFileMap(ExeConfigFilename = __SOURCE_DIRECTORY__ + "/app.config") diff --git a/src/LogicalHacking.ExtensionDsLab/LogicalHacking.ExtensionDsLab.fsproj b/src/LogicalHacking.ExtensionDsLab/LogicalHacking.ExtensionDsLab.fsproj index bc6f479..b457e6e 100644 --- a/src/LogicalHacking.ExtensionDsLab/LogicalHacking.ExtensionDsLab.fsproj +++ b/src/LogicalHacking.ExtensionDsLab/LogicalHacking.ExtensionDsLab.fsproj @@ -16,7 +16,8 @@ true - + + diff --git a/src/LogicalHacking.ExtensionDsLab/MySqlConnector.fs b/src/LogicalHacking.ExtensionDsLab/MySqlConnector.fs new file mode 100644 index 0000000..0b241c2 --- /dev/null +++ b/src/LogicalHacking.ExtensionDsLab/MySqlConnector.fs @@ -0,0 +1,39 @@ +(* + * This file is part of the ExtensionDsLab project. + * Copyright (c) 2017 LogicalHacking.com + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, version 3. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + *) + +namespace LogicalHacking.ExtensionDsLab.Archive + +open FSharp.Data.Sql +open System.IO + +module MySqlConnector = + [] + let ConnectionStringName = @"ProductionExtensionDB" + [] + let ResolutionPath = __SOURCE_DIRECTORY__ + @"/../../packages/MySql.Data/lib/net452" + + // create a type alias with the connection string and database vendor settings + type ExtensionDbProvider = SqlDataProvider< + DatabaseVendor = Common.DatabaseProviderTypes.MYSQL, + ConnectionStringName = ConnectionStringName, + ResolutionPath = ResolutionPath, + IndividualsAmount = 500, + UseOptionTypes = true > + + type ExtensionDbType = ExtensionDbProvider.dataContext diff --git a/src/LogicalHacking.ExtensionDsLab/Script.fsx b/src/LogicalHacking.ExtensionDsLab/Script.fsx index fc4fe59..06898de 100644 --- a/src/LogicalHacking.ExtensionDsLab/Script.fsx +++ b/src/LogicalHacking.ExtensionDsLab/Script.fsx @@ -20,7 +20,8 @@ #load "ExtensionDsLab.fsx" open LogicalHacking.ExtensionDsLab -open LogicalHacking.ExtensionDsLab.Archive.SqlConnector +open LogicalHacking.ExtensionDsLab.Archive.MySqlConnector +open LogicalHacking.ExtensionDsLab.Archive.ExtensionCore open Deedle open FSharp.Data