diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2017-12-10 16:46:54 +0200 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2017-12-10 16:46:54 +0200 |
| commit | 3eabdee9604ad67cdbab7ee35bdfa249402f8831 (patch) | |
| tree | 430724d34efbab485821b3bbab28bfbe92b6df26 /Software/Visual_Studio/Utilities | |
| parent | 8b4e0971171d40844ca1c63591aeb1fbe4add759 (diff) | |
| download | Tango-3eabdee9604ad67cdbab7ee35bdfa249402f8831.tar.gz Tango-3eabdee9604ad67cdbab7ee35bdfa249402f8831.zip | |
Implemented DB Observables Generator CLI for DAL.Observables post build event.
Changes DB table FIBER_SYNTHESIS to FIBER_SYNTHESISES to normalize singularization.
Diffstat (limited to 'Software/Visual_Studio/Utilities')
5 files changed, 160 insertions, 0 deletions
diff --git a/Software/Visual_Studio/Utilities/Tango.DBObservablesGenerator.CLI/App.config b/Software/Visual_Studio/Utilities/Tango.DBObservablesGenerator.CLI/App.config new file mode 100644 index 000000000..92aa00bf9 --- /dev/null +++ b/Software/Visual_Studio/Utilities/Tango.DBObservablesGenerator.CLI/App.config @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="utf-8"?> +<configuration> + <configSections> + <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --> + <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> + </configSections> + <startup> + <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6" /> + </startup> + <entityFramework> + <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" /> + <providers> + <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" /> + </providers> + </entityFramework> +</configuration>
\ No newline at end of file diff --git a/Software/Visual_Studio/Utilities/Tango.DBObservablesGenerator.CLI/Program.cs b/Software/Visual_Studio/Utilities/Tango.DBObservablesGenerator.CLI/Program.cs new file mode 100644 index 000000000..742b1428d --- /dev/null +++ b/Software/Visual_Studio/Utilities/Tango.DBObservablesGenerator.CLI/Program.cs @@ -0,0 +1,61 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Core.Helpers; +using Tango.DAL.Observables; + +namespace Tango.DBObservablesGenerator.CLI +{ + class Program + { + static void Main(string[] args) + { + try + { + if (args == null || args.Length == 0) + { + ExitError("Invalid arguments!"); + } + + String targetPath = args[0]; + + ObservablesGenerator generator = new ObservablesGenerator(); + + foreach (var file in Directory.GetFiles(targetPath)) + { + PathHelper.TryDeleteFile(file); + } + + try + { + generator.Generate(targetPath); + } + catch (Exception ex) + { + ExitError(ex.ToString()); + } + + ExitSuccess("Tango DAL observables generated on: '" + targetPath + "'\nPlease build again to ensure compatibility."); + } + catch + { + ExitSuccess("Tango DAL observables generation skipped! Try Build again..."); + } + } + + private static void ExitError(String error) + { + Console.WriteLine(error); + Environment.Exit(-1); + } + + private static void ExitSuccess(String text) + { + Console.WriteLine(text); + Environment.Exit(0); + } + } +} diff --git a/Software/Visual_Studio/Utilities/Tango.DBObservablesGenerator.CLI/Properties/AssemblyInfo.cs b/Software/Visual_Studio/Utilities/Tango.DBObservablesGenerator.CLI/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..9260e2580 --- /dev/null +++ b/Software/Visual_Studio/Utilities/Tango.DBObservablesGenerator.CLI/Properties/AssemblyInfo.cs @@ -0,0 +1,6 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +[assembly: AssemblyTitle("Tango - Machine Designer")] +[assembly: ComVisible(false)]
\ No newline at end of file diff --git a/Software/Visual_Studio/Utilities/Tango.DBObservablesGenerator.CLI/Tango.DBObservablesGenerator.CLI.csproj b/Software/Visual_Studio/Utilities/Tango.DBObservablesGenerator.CLI/Tango.DBObservablesGenerator.CLI.csproj new file mode 100644 index 000000000..f996d017d --- /dev/null +++ b/Software/Visual_Studio/Utilities/Tango.DBObservablesGenerator.CLI/Tango.DBObservablesGenerator.CLI.csproj @@ -0,0 +1,73 @@ +<?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>{EBB7CB9F-6AF2-456B-A5DD-1B136B605D90}</ProjectGuid> + <OutputType>Exe</OutputType> + <RootNamespace>Tango.DBObservablesGenerator.CLI</RootNamespace> + <AssemblyName>dbobgen</AssemblyName> + <TargetFrameworkVersion>v4.6</TargetFrameworkVersion> + <FileAlignment>512</FileAlignment> + <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <PlatformTarget>AnyCPU</PlatformTarget> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>..\..\Build\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="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"> + <HintPath>..\..\packages\EntityFramework.6.0.0\lib\net45\EntityFramework.dll</HintPath> + </Reference> + <Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"> + <HintPath>..\..\packages\EntityFramework.6.0.0\lib\net45\EntityFramework.SqlServer.dll</HintPath> + </Reference> + <Reference Include="System" /> + <Reference Include="System.ComponentModel.DataAnnotations" /> + <Reference Include="System.Core" /> + <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="..\..\Versioning\GlobalVersionInfo.cs"> + <Link>GlobalVersionInfo.cs</Link> + </Compile> + <Compile Include="Program.cs" /> + <Compile Include="Properties\AssemblyInfo.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="App.config" /> + <None Include="packages.config" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\..\Tango.Core\Tango.Core.csproj"> + <Project>{a34ee0f0-649d-41c8-8489-b6f1cc6924ee}</Project> + <Name>Tango.Core</Name> + </ProjectReference> + <ProjectReference Include="..\..\Tango.DAL.Observables\Tango.DAL.Observables.csproj"> + <Project>{0ecd6da8-7aa6-48d9-8b65-279d176ad9af}</Project> + <Name>Tango.DAL.Observables</Name> + </ProjectReference> + </ItemGroup> + <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> +</Project>
\ No newline at end of file diff --git a/Software/Visual_Studio/Utilities/Tango.DBObservablesGenerator.CLI/packages.config b/Software/Visual_Studio/Utilities/Tango.DBObservablesGenerator.CLI/packages.config new file mode 100644 index 000000000..9256e1591 --- /dev/null +++ b/Software/Visual_Studio/Utilities/Tango.DBObservablesGenerator.CLI/packages.config @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="utf-8"?> +<packages> + <package id="EntityFramework" version="6.0.0" targetFramework="net46" /> +</packages>
\ No newline at end of file |
