This commit is contained in:
Benjamin Ifland
2019-03-23 17:36:44 +01:00
19 changed files with 1910 additions and 35 deletions

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.props" Condition="Exists('..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.props')" />
<Import Project="..\packages\MSTest.TestAdapter.1.4.0\build\net45\MSTest.TestAdapter.props" Condition="Exists('..\packages\MSTest.TestAdapter.1.4.0\build\net45\MSTest.TestAdapter.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -45,20 +45,20 @@
<Reference Include="Microsoft.Data.OData, Version=5.8.4.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Data.OData.5.8.4\lib\net40\Microsoft.Data.OData.dll</HintPath>
</Reference>
<Reference Include="Microsoft.OData.Core, Version=7.5.3.21218, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.OData.Core.7.5.3\lib\portable-net45+win8+wpa81\Microsoft.OData.Core.dll</HintPath>
<Reference Include="Microsoft.OData.Core, Version=7.5.4.30215, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.OData.Core.7.5.4\lib\portable-net45+win8+wpa81\Microsoft.OData.Core.dll</HintPath>
</Reference>
<Reference Include="Microsoft.OData.Edm, Version=7.5.3.21218, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.OData.Edm.7.5.3\lib\portable-net45+win8+wpa81\Microsoft.OData.Edm.dll</HintPath>
<Reference Include="Microsoft.OData.Edm, Version=7.5.4.30215, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.OData.Edm.7.5.4\lib\portable-net45+win8+wpa81\Microsoft.OData.Edm.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Spatial, Version=7.5.3.21218, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Spatial.7.5.3\lib\portable-net45+win8+wpa81\Microsoft.Spatial.dll</HintPath>
<Reference Include="Microsoft.Spatial, Version=7.5.4.30215, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Spatial.7.5.4\lib\portable-net45+win8+wpa81\Microsoft.Spatial.dll</HintPath>
</Reference>
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\MSTest.TestFramework.1.3.2\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll</HintPath>
<HintPath>..\packages\MSTest.TestFramework.1.4.0\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll</HintPath>
</Reference>
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\MSTest.TestFramework.1.3.2\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll</HintPath>
<HintPath>..\packages\MSTest.TestFramework.1.4.0\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll</HintPath>
</Reference>
<Reference Include="Simple.OData.Client.Core, Version=5.6.2.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Simple.OData.Client.5.6.2\lib\net452\Simple.OData.Client.Core.dll</HintPath>
@@ -102,8 +102,8 @@
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.props'))" />
<Error Condition="!Exists('..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.targets'))" />
<Error Condition="!Exists('..\packages\MSTest.TestAdapter.1.4.0\build\net45\MSTest.TestAdapter.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.1.4.0\build\net45\MSTest.TestAdapter.props'))" />
<Error Condition="!Exists('..\packages\MSTest.TestAdapter.1.4.0\build\net45\MSTest.TestAdapter.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.1.4.0\build\net45\MSTest.TestAdapter.targets'))" />
</Target>
<Import Project="..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.targets" Condition="Exists('..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.targets')" />
<Import Project="..\packages\MSTest.TestAdapter.1.4.0\build\net45\MSTest.TestAdapter.targets" Condition="Exists('..\packages\MSTest.TestAdapter.1.4.0\build\net45\MSTest.TestAdapter.targets')" />
</Project>

View File

@@ -1,8 +1,39 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
<add key="url" value="http://localhost/API"/>
<add key="url" value="http://localhost/API" />
<!--<add key="url" value="http://test.benjamin-ifland.de"/>-->
</appSettings>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.OData.Core" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-7.5.4.30215" newVersion="7.5.4.30215" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.OData.Edm" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-7.5.4.30215" newVersion="7.5.4.30215" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Spatial" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-7.5.4.30215" newVersion="7.5.4.30215" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

View File

@@ -2,11 +2,11 @@
<packages>
<package id="Microsoft.Data.Edm" version="5.8.4" targetFramework="net462" />
<package id="Microsoft.Data.OData" version="5.8.4" targetFramework="net462" />
<package id="Microsoft.OData.Core" version="7.5.3" targetFramework="net462" />
<package id="Microsoft.OData.Edm" version="7.5.3" targetFramework="net462" />
<package id="Microsoft.Spatial" version="7.5.3" targetFramework="net462" />
<package id="MSTest.TestAdapter" version="1.3.2" targetFramework="net462" />
<package id="MSTest.TestFramework" version="1.3.2" targetFramework="net462" />
<package id="Microsoft.OData.Core" version="7.5.4" targetFramework="net462" />
<package id="Microsoft.OData.Edm" version="7.5.4" targetFramework="net462" />
<package id="Microsoft.Spatial" version="7.5.4" targetFramework="net462" />
<package id="MSTest.TestAdapter" version="1.4.0" targetFramework="net462" />
<package id="MSTest.TestFramework" version="1.4.0" targetFramework="net462" />
<package id="Simple.OData.Client" version="5.6.2" targetFramework="net462" />
<package id="System.Spatial" version="5.8.4" targetFramework="net462" />
</packages>

View File

@@ -37,14 +37,14 @@
<Reference Include="Microsoft.Data.OData, Version=5.8.4.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Data.OData.5.8.4\lib\net40\Microsoft.Data.OData.dll</HintPath>
</Reference>
<Reference Include="Microsoft.OData.Core, Version=7.5.3.21218, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.OData.Core.7.5.3\lib\portable-net45+win8+wpa81\Microsoft.OData.Core.dll</HintPath>
<Reference Include="Microsoft.OData.Core, Version=7.5.4.30215, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.OData.Core.7.5.4\lib\portable-net45+win8+wpa81\Microsoft.OData.Core.dll</HintPath>
</Reference>
<Reference Include="Microsoft.OData.Edm, Version=7.5.3.21218, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.OData.Edm.7.5.3\lib\portable-net45+win8+wpa81\Microsoft.OData.Edm.dll</HintPath>
<Reference Include="Microsoft.OData.Edm, Version=7.5.4.30215, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.OData.Edm.7.5.4\lib\portable-net45+win8+wpa81\Microsoft.OData.Edm.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Spatial, Version=7.5.3.21218, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Spatial.7.5.3\lib\portable-net45+win8+wpa81\Microsoft.Spatial.dll</HintPath>
<Reference Include="Microsoft.Spatial, Version=7.5.4.30215, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Spatial.7.5.4\lib\portable-net45+win8+wpa81\Microsoft.Spatial.dll</HintPath>
</Reference>
<Reference Include="Simple.OData.Client.Core, Version=5.6.2.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Simple.OData.Client.5.6.2\lib\net452\Simple.OData.Client.Core.dll</HintPath>
@@ -80,6 +80,7 @@
<WCFMetadata Include="Connected Services\" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>

19
API/API.Client/app.config Normal file
View File

@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.OData.Core" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-7.5.4.30215" newVersion="7.5.4.30215" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.OData.Edm" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-7.5.4.30215" newVersion="7.5.4.30215" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Spatial" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-7.5.4.30215" newVersion="7.5.4.30215" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

View File

@@ -2,9 +2,9 @@
<packages>
<package id="Microsoft.Data.Edm" version="5.8.4" targetFramework="net462" />
<package id="Microsoft.Data.OData" version="5.8.4" targetFramework="net462" />
<package id="Microsoft.OData.Core" version="7.5.3" targetFramework="net462" />
<package id="Microsoft.OData.Edm" version="7.5.3" targetFramework="net462" />
<package id="Microsoft.Spatial" version="7.5.3" targetFramework="net462" />
<package id="Microsoft.OData.Core" version="7.5.4" targetFramework="net462" />
<package id="Microsoft.OData.Edm" version="7.5.4" targetFramework="net462" />
<package id="Microsoft.Spatial" version="7.5.4" targetFramework="net462" />
<package id="Simple.OData.Client" version="5.6.2" targetFramework="net462" />
<package id="System.Spatial" version="5.8.4" targetFramework="net462" />
</packages>

View File

@@ -19,6 +19,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Shared", "Shared", "{E1B05E
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "API.Models", "Models\API.Models.csproj", "{8D72FF7D-C085-4C06-9D66-9537B7AC924D}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tools", "Tools", "{0298B379-812E-45C9-BC84-744BC848D2E5}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Migration", "Migration\Migration.csproj", "{48EBC2B8-5256-44BC-8A39-3A3C8C388BC6}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -45,6 +49,10 @@ Global
{8D72FF7D-C085-4C06-9D66-9537B7AC924D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8D72FF7D-C085-4C06-9D66-9537B7AC924D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8D72FF7D-C085-4C06-9D66-9537B7AC924D}.Release|Any CPU.Build.0 = Release|Any CPU
{48EBC2B8-5256-44BC-8A39-3A3C8C388BC6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{48EBC2B8-5256-44BC-8A39-3A3C8C388BC6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{48EBC2B8-5256-44BC-8A39-3A3C8C388BC6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{48EBC2B8-5256-44BC-8A39-3A3C8C388BC6}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -55,6 +63,7 @@ Global
{88DB6691-8EE1-428C-8DA4-50342AEB2C54} = {D89C3FFE-4990-4B35-977C-727F89D7D05E}
{52BDCA0E-DC33-4398-BB6F-485CB07DE980} = {D89C3FFE-4990-4B35-977C-727F89D7D05E}
{8D72FF7D-C085-4C06-9D66-9537B7AC924D} = {E1B05E83-7E28-47D6-9DB5-3C1B2293AA92}
{48EBC2B8-5256-44BC-8A39-3A3C8C388BC6} = {0298B379-812E-45C9-BC84-744BC848D2E5}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {27650156-7B3F-4C0C-83D3-D13119DE083F}

View File

@@ -133,6 +133,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="App_Start\DependencyInjectionConfig.cs" />
<Compile Include="App_Start\EnvironmentConfig.cs" />
<Compile Include="App_Start\WebApiConfig.cs" />
<Compile Include="Controllers\FilesController.cs" />
<Compile Include="Controllers\SongsController.cs" />
@@ -178,6 +179,7 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Content Include="App_Data\environment.json" />
<None Include="packages.config" />
<None Include="Properties\PublishProfiles\deploy to test.pubxml" />
</ItemGroup>
@@ -192,9 +194,7 @@
<DependentUpon>201903172028249_Log.cs</DependentUpon>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<Folder Include="App_Data\" />
</ItemGroup>
<ItemGroup />
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>

View File

@@ -0,0 +1,20 @@
using Newtonsoft.Json;
using System.IO;
namespace API.App_Start {
public static class EnvironmentConfig {
public static Config Read() {
var path = System.Web.Hosting.HostingEnvironment.MapPath(@"~/App_Data");
var jsonFile = Path.Combine(path, "environment.json");
if (!File.Exists(jsonFile)) return null;
var file = File.ReadAllText(jsonFile);
return JsonConvert.DeserializeObject<Config>(file);
}
}
public class Config {
public string ConnectionString { get; set; }
public string CorsUrls { get; set; }
}
}

View File

@@ -11,8 +11,9 @@ namespace API {
public static void Register(HttpConfiguration config) {
// CORS
var cors = new EnableCorsAttribute("http://localhost:4200", "*", "*");
cors.SupportsCredentials = true;
var cors = new EnableCorsAttribute(EnvironmentConfig.Read()?.CorsUrls ?? "http://localhost:4200", "*", "*") {
SupportsCredentials = true
};
config.EnableCors(cors);
// Web API configuration and services

View File

@@ -1,11 +1,12 @@
using API.Migrations;
using API.App_Start;
using API.Migrations;
using API.Models;
using System.Data.Entity;
namespace API.Database {
public class DataContext : DbContext {
public DataContext() : base("DataContext") {
public DataContext() : base(EnvironmentConfig.Read()?.ConnectionString ?? "DataContext") {
System.Data.Entity.Database.SetInitializer(new MigrateDatabaseToLatestVersion<DataContext, Configuration>());
}

39
API/Migration/App.config Normal file
View File

@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
<!--<add key="url" value="http://localhost/API" />-->
<add key="url" value="http://test.benjamin-ifland.de"/>
</appSettings>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.OData.Core" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-7.5.4.30215" newVersion="7.5.4.30215" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.OData.Edm" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-7.5.4.30215" newVersion="7.5.4.30215" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Spatial" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-7.5.4.30215" newVersion="7.5.4.30215" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

View File

@@ -0,0 +1,95 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{48EBC2B8-5256-44BC-8A39-3A3C8C388BC6}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>Migration</RootNamespace>
<AssemblyName>Migration</AssemblyName>
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.Data.Edm, Version=5.8.4.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Data.Edm.5.8.4\lib\net40\Microsoft.Data.Edm.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Data.OData, Version=5.8.4.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Data.OData.5.8.4\lib\net40\Microsoft.Data.OData.dll</HintPath>
</Reference>
<Reference Include="Microsoft.OData.Core, Version=7.5.4.30215, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.OData.Core.7.5.4\lib\portable-net45+win8+wpa81\Microsoft.OData.Core.dll</HintPath>
</Reference>
<Reference Include="Microsoft.OData.Edm, Version=7.5.4.30215, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.OData.Edm.7.5.4\lib\portable-net45+win8+wpa81\Microsoft.OData.Edm.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Spatial, Version=7.5.4.30215, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Spatial.7.5.4\lib\portable-net45+win8+wpa81\Microsoft.Spatial.dll</HintPath>
</Reference>
<Reference Include="Simple.OData.Client.Core, Version=5.6.2.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Simple.OData.Client.5.6.2\lib\net452\Simple.OData.Client.Core.dll</HintPath>
</Reference>
<Reference Include="Simple.OData.Client.Dynamic, Version=5.6.2.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Simple.OData.Client.5.6.2\lib\net452\Simple.OData.Client.Dynamic.dll</HintPath>
</Reference>
<Reference Include="Simple.OData.Client.V3.Adapter, Version=5.6.2.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Simple.OData.Client.5.6.2\lib\net452\Simple.OData.Client.V3.Adapter.dll</HintPath>
</Reference>
<Reference Include="Simple.OData.Client.V4.Adapter, Version=5.6.2.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Simple.OData.Client.5.6.2\lib\net452\Simple.OData.Client.V4.Adapter.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Spatial, Version=5.8.4.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\System.Spatial.5.8.4\lib\net40\System.Spatial.dll</HintPath>
</Reference>
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="SongDataset.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\API.Client\API.Client.csproj">
<Project>{88db6691-8ee1-428c-8da4-50342aeb2c54}</Project>
<Name>API.Client</Name>
</ProjectReference>
<ProjectReference Include="..\Models\API.Models.csproj">
<Project>{8d72ff7d-c085-4c06-9d66-9537b7ac924d}</Project>
<Name>API.Models</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

67
API/Migration/Program.cs Normal file
View File

@@ -0,0 +1,67 @@
using API.Client;
using API.Models;
using Data;
using System;
using System.IO;
using System.Threading.Tasks;
namespace Migration {
internal class Program {
private static void Main(string[] args) {
var path = @"d:\Documents\Worship Generator\";
for (var i = 0; i < 500; i++) {
var xmlFile = Path.Combine(path, i.ToString() + ".xml");
if (!System.IO.File.Exists(xmlFile)) continue;
var ds = new SongDataset();
ds.ReadXml(xmlFile);
var source = ds.SONGLIST[0];
var song = new Song {
Name = source.NAME.TrimEnd('\r', '\n'),
Number = source.NUMBER,
SongType = MapSongType(source),
Tempo = source.IsSPEEDNull() ? (int?)null : source.SPEED,
Key = MapKey(source),
Text = source.IsPREVIEWNull() ? null : source.PREVIEW,
Comments = source.IsCOMMENTNull() ? null : source.COMMENT,
Final = source.IsFINALNull() ? false : source.FINAL
};
Console.WriteLine(song.Name);
var client = new Client();
Task.WaitAll(new[] { client.Post(song) });
}
Console.ReadKey();
}
private static SongType MapSongType(SongDataset.SONGLISTRow source) {
if (source.IsKINDNull()) return SongType.None;
switch (source.KIND) {
case "Lobpreis": return SongType.Praise;
case "Anbetung": return SongType.Worship;
default: return SongType.None;
}
}
private static string MapKey(SongDataset.SONGLISTRow source) {
if (source.IsHARMONICNull()) return null;
switch (source.HARMONIC) {
case "D": return KeysSMaj.D;
case "a": return KeysSMin.A;
case "d": return KeysSMin.D;
case "G": return KeysSMaj.G;
case "E": return KeysSMaj.E;
case "C": return KeysSMaj.C;
case "A": return KeysSMaj.A;
case "e": return KeysSMin.E;
case "fis": return KeysSMin.FS;
default: return null;
}
}
}
}

View File

@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Migration")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Migration")]
[assembly: AssemblyCopyright("Copyright © 2019")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("48ebc2b8-5256-44bc-8a39-3a3c8c388bc6")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

1483
API/Migration/SongDataset.cs Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Data.Edm" version="5.8.4" targetFramework="net462" />
<package id="Microsoft.Data.OData" version="5.8.4" targetFramework="net462" />
<package id="Microsoft.OData.Core" version="7.5.4" targetFramework="net462" />
<package id="Microsoft.OData.Edm" version="7.5.4" targetFramework="net462" />
<package id="Microsoft.Spatial" version="7.5.4" targetFramework="net462" />
<package id="Simple.OData.Client" version="5.6.2" targetFramework="net462" />
<package id="System.Spatial" version="5.8.4" targetFramework="net462" />
</packages>

View File

@@ -19,4 +19,66 @@ namespace API.Models {
public virtual ICollection<File> Files { get; set; }
}
public class KeysSMaj {
public const string C = "C";
public const string CS = "C#";
public const string D = "D";
public const string DS = "D#";
public const string E = "E";
public const string F = "F";
public const string FS = "F#";
public const string G = "G";
public const string GS = "G#";
public const string A = "A";
public const string AS = "A#";
public const string H = "H";
}
public class KeysSMin {
public const string C = "c";
public const string CS = "c#";
public const string D = "d";
public const string DS = "d#";
public const string E = "e";
public const string F = "f";
public const string FS = "f#";
public const string G = "g";
public const string GS = "g#";
public const string A = "a";
public const string AS = "a#";
public const string H = "h";
}
public class KeysBMaj {
public const string C = "C";
public const string DB = "Db";
public const string D = "D";
public const string EB = "Eb";
public const string E = "E";
public const string F = "F";
public const string GB = "Gb";
public const string G = "G";
public const string AB = "Ab";
public const string A = "A";
public const string HB = "B";
public const string H = "H";
}
public class KeysBMin {
public const string C = "a";
public const string DB = "db";
public const string D = "d";
public const string EB = "eb";
public const string E = "e";
public const string F = "f";
public const string GB = "gb";
public const string G = "g";
public const string AB = "ab";
public const string A = "a";
public const string HB = "b";
public const string H = "h";
}
}

View File

@@ -1,7 +1,8 @@
namespace API.Models {
public enum SongType {
Praise,
Worship
Worship,
None
}
}