-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactoring configuration file to json schema
- Loading branch information
Showing
26 changed files
with
9,526 additions
and
377 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
|
||
namespace DBUpdateManager.Core.Config | ||
{ | ||
public class ConfigEntity : IConfig | ||
{ | ||
|
||
public string CarpetaDeIncidencias | ||
{ | ||
get; | ||
set; | ||
} | ||
|
||
public string ConnectionString | ||
{ | ||
get; | ||
set; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.IO; | ||
using Newtonsoft.Json; | ||
|
||
namespace DBUpdateManager.Core.Config | ||
{ | ||
public class ConfigManager | ||
{ | ||
private const string kConfigurationFile = "DBUpdateManager.config.json"; | ||
|
||
public ConfigEntity ReadConfig() | ||
{ | ||
string json = string.Empty; | ||
try | ||
{ | ||
json = new StreamReader(kConfigurationFile).ReadToEnd(); | ||
} | ||
catch (FileNotFoundException fex) | ||
{ | ||
throw new ApplicationException("configuration file not found: " + kConfigurationFile, fex); | ||
} | ||
catch (Exception ex) | ||
{ | ||
throw ex; | ||
} | ||
|
||
var entity = JsonConvert.DeserializeObject<ConfigEntity>(json); | ||
return entity; | ||
} | ||
|
||
public void WriteConfig(ConfigEntity entity) | ||
{ | ||
var json = JsonConvert.SerializeObject(entity); | ||
try | ||
{ | ||
new StreamWriter(kConfigurationFile).Write(json); | ||
} | ||
catch (Exception ex) | ||
{ | ||
throw new ApplicationException("error writing file: " + kConfigurationFile, ex); | ||
} | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
|
||
namespace DBUpdateManager.Core.Config | ||
{ | ||
interface IConfig | ||
{ | ||
string CarpetaDeIncidencias { get; } | ||
string ConnectionString { get; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<PropertyGroup> | ||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
<ProductVersion>8.0.30703</ProductVersion> | ||
<SchemaVersion>2.0</SchemaVersion> | ||
<ProjectGuid>{7B2C7AC0-8FD7-46BB-908A-BA55DA2C30A3}</ProjectGuid> | ||
<OutputType>Library</OutputType> | ||
<AppDesignerFolder>Properties</AppDesignerFolder> | ||
<RootNamespace>DBUpdateManager.Core</RootNamespace> | ||
<AssemblyName>DBUpdateManager.Core</AssemblyName> | ||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion> | ||
<FileAlignment>512</FileAlignment> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
<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' "> | ||
<DebugType>pdbonly</DebugType> | ||
<Optimize>true</Optimize> | ||
<OutputPath>bin\Release\</OutputPath> | ||
<DefineConstants>TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Reference Include="Newtonsoft.Json"> | ||
<HintPath>..\Lib\Newtonsoft.Json.dll</HintPath> | ||
</Reference> | ||
<Reference Include="System" /> | ||
<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.Xml" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Include="Config\ConfigManager.cs" /> | ||
<Compile Include="Config\ConfigEntity.cs" /> | ||
<Compile Include="Config\IConfig.cs" /> | ||
<Compile Include="Db\TransactionManager.cs" /> | ||
<Compile Include="Issue\IssueEntity.cs" /> | ||
<Compile Include="Issue\IssueFactory.cs" /> | ||
<Compile Include="Issue\IssueManager.cs" /> | ||
<Compile Include="Properties\AssemblyInfo.cs" /> | ||
<Compile Include="Script\ScriptEntity.cs" /> | ||
<Compile Include="Script\ScriptFactory.cs" /> | ||
<Compile Include="Script\ScriptTypeEnum.cs" /> | ||
</ItemGroup> | ||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | ||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. | ||
Other similar extension points exist, see Microsoft.Common.targets. | ||
<Target Name="BeforeBuild"> | ||
</Target> | ||
<Target Name="AfterBuild"> | ||
</Target> | ||
--> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.