From e3217663c3db86d457e803a177af33842e3f5a12 Mon Sep 17 00:00:00 2001 From: josdeweger Date: Sun, 6 Jan 2019 21:47:49 +0100 Subject: [PATCH] Renamed consoleapp to examples --- .../AppSettings.cs | 16 +-- .../CsvAppWithValidationErrors.cs | 4 +- .../CsvAppWithoutValidationErrors.cs | 4 +- .../ExcelApp.cs | 80 ++++++------ .../Files/Sample - Superstore.xlsx | Bin .../Files/profiles-with-validation-errors.csv | 0 .../profiles-without-validation-errors.csv | 0 .../Files/profiles.xlsx | Bin .../GoogleSheetsApp.cs | 94 +++++++------- .../Models/EpicTracking.cs | 2 +- .../Models/Profile.cs | 2 +- .../Models/Superstore.cs | 2 +- .../Program.cs | 116 +++++++++--------- .../ProtectedGoogleSheetsApp.cs | 88 ++++++------- .../ServiceConfigurator.cs | 76 ++++++------ .../EpicTrackingConfig.cs | 4 +- .../SheetToObjectConfigs/SuperstoreConfig.cs | 4 +- .../SheetToObjects-a96682815641.json | 0 .../SheetToObjects.Examples.csproj} | 96 +++++++-------- .../app-settings.default.json | 12 +- src/SheetToObjects.Examples/app-settings.json | 6 + src/SheetToObjects.sln | 14 +-- 22 files changed, 313 insertions(+), 307 deletions(-) rename src/{SheetToObjects.ConsoleApp => SheetToObjects.Examples}/AppSettings.cs (73%) rename src/{SheetToObjects.ConsoleApp => SheetToObjects.Examples}/CsvAppWithValidationErrors.cs (95%) rename src/{SheetToObjects.ConsoleApp => SheetToObjects.Examples}/CsvAppWithoutValidationErrors.cs (95%) rename src/{SheetToObjects.ConsoleApp => SheetToObjects.Examples}/ExcelApp.cs (92%) rename src/{SheetToObjects.ConsoleApp => SheetToObjects.Examples}/Files/Sample - Superstore.xlsx (100%) rename src/{SheetToObjects.ConsoleApp => SheetToObjects.Examples}/Files/profiles-with-validation-errors.csv (100%) rename src/{SheetToObjects.ConsoleApp => SheetToObjects.Examples}/Files/profiles-without-validation-errors.csv (100%) rename src/{SheetToObjects.ConsoleApp => SheetToObjects.Examples}/Files/profiles.xlsx (100%) rename src/{SheetToObjects.ConsoleApp => SheetToObjects.Examples}/GoogleSheetsApp.cs (93%) rename src/{SheetToObjects.ConsoleApp => SheetToObjects.Examples}/Models/EpicTracking.cs (90%) rename src/{SheetToObjects.ConsoleApp => SheetToObjects.Examples}/Models/Profile.cs (97%) rename src/{SheetToObjects.ConsoleApp => SheetToObjects.Examples}/Models/Superstore.cs (96%) rename src/{SheetToObjects.ConsoleApp => SheetToObjects.Examples}/Program.cs (95%) rename src/{SheetToObjects.ConsoleApp => SheetToObjects.Examples}/ProtectedGoogleSheetsApp.cs (93%) rename src/{SheetToObjects.ConsoleApp => SheetToObjects.Examples}/ServiceConfigurator.cs (95%) rename src/{SheetToObjects.ConsoleApp => SheetToObjects.Examples}/SheetToObjectConfigs/EpicTrackingConfig.cs (90%) rename src/{SheetToObjects.ConsoleApp => SheetToObjects.Examples}/SheetToObjectConfigs/SuperstoreConfig.cs (95%) rename src/{SheetToObjects.ConsoleApp => SheetToObjects.Examples}/SheetToObjects-a96682815641.json (100%) rename src/{SheetToObjects.ConsoleApp/SheetToObjects.ConsoleApp.csproj => SheetToObjects.Examples/SheetToObjects.Examples.csproj} (97%) rename src/{SheetToObjects.ConsoleApp => SheetToObjects.Examples}/app-settings.default.json (95%) create mode 100644 src/SheetToObjects.Examples/app-settings.json diff --git a/src/SheetToObjects.ConsoleApp/AppSettings.cs b/src/SheetToObjects.Examples/AppSettings.cs similarity index 73% rename from src/SheetToObjects.ConsoleApp/AppSettings.cs rename to src/SheetToObjects.Examples/AppSettings.cs index 2945258..a3b1569 100644 --- a/src/SheetToObjects.ConsoleApp/AppSettings.cs +++ b/src/SheetToObjects.Examples/AppSettings.cs @@ -1,8 +1,8 @@ -namespace SheetToObjects.ConsoleApp -{ - public class AppSettings - { - public string ApiKey { get; set; } - public string SheetId { get; set; } - } -} +namespace SheetToObjects.Examples +{ + public class AppSettings + { + public string ApiKey { get; set; } + public string SheetId { get; set; } + } +} diff --git a/src/SheetToObjects.ConsoleApp/CsvAppWithValidationErrors.cs b/src/SheetToObjects.Examples/CsvAppWithValidationErrors.cs similarity index 95% rename from src/SheetToObjects.ConsoleApp/CsvAppWithValidationErrors.cs rename to src/SheetToObjects.Examples/CsvAppWithValidationErrors.cs index b4f5ce5..276426e 100644 --- a/src/SheetToObjects.ConsoleApp/CsvAppWithValidationErrors.cs +++ b/src/SheetToObjects.Examples/CsvAppWithValidationErrors.cs @@ -1,11 +1,11 @@ using System; using System.IO; -using SheetToObjects.ConsoleApp.Models; using SheetToObjects.Core; +using SheetToObjects.Examples.Models; using SheetToObjects.Lib; using IProvideSheet = SheetToObjects.Adapters.Csv.IProvideSheet; -namespace SheetToObjects.ConsoleApp +namespace SheetToObjects.Examples { public class CsvAppWithValidationErrors { diff --git a/src/SheetToObjects.ConsoleApp/CsvAppWithoutValidationErrors.cs b/src/SheetToObjects.Examples/CsvAppWithoutValidationErrors.cs similarity index 95% rename from src/SheetToObjects.ConsoleApp/CsvAppWithoutValidationErrors.cs rename to src/SheetToObjects.Examples/CsvAppWithoutValidationErrors.cs index c181d1c..cc710a9 100644 --- a/src/SheetToObjects.ConsoleApp/CsvAppWithoutValidationErrors.cs +++ b/src/SheetToObjects.Examples/CsvAppWithoutValidationErrors.cs @@ -1,11 +1,11 @@ using System; using System.IO; -using SheetToObjects.ConsoleApp.Models; using SheetToObjects.Core; +using SheetToObjects.Examples.Models; using SheetToObjects.Lib; using IProvideSheet = SheetToObjects.Adapters.Csv.IProvideSheet; -namespace SheetToObjects.ConsoleApp +namespace SheetToObjects.Examples { public class CsvAppWithoutValidationErrors { diff --git a/src/SheetToObjects.ConsoleApp/ExcelApp.cs b/src/SheetToObjects.Examples/ExcelApp.cs similarity index 92% rename from src/SheetToObjects.ConsoleApp/ExcelApp.cs rename to src/SheetToObjects.Examples/ExcelApp.cs index 4e9fb13..a0a79b0 100644 --- a/src/SheetToObjects.ConsoleApp/ExcelApp.cs +++ b/src/SheetToObjects.Examples/ExcelApp.cs @@ -1,41 +1,41 @@ -using System; -using SheetToObjects.Adapters.MicrosoftExcel; -using SheetToObjects.ConsoleApp.Models; -using SheetToObjects.Core; -using SheetToObjects.Lib; - -namespace SheetToObjects.ConsoleApp -{ - public class ExcelApp - { - private readonly IProvideSheet _sheetProvider; - private readonly IMapSheetToObjects _sheetMapper; - - public ExcelApp( - IProvideSheet sheetProvider, - IMapSheetToObjects sheetMapper) - { - _sheetProvider = sheetProvider; - _sheetMapper = sheetMapper; - } - - public void Run() - { - var result = Timer.TimeFunc(() => - { - var excelRange = new ExcelRange(new ExcelCell("A", 1), new ExcelCell("U", 9995)); - var sheet = _sheetProvider.GetFromPath(@"./Files/Sample - Superstore.xlsx", "orders", excelRange); - - return _sheetMapper.Map(sheet); - }); - - foreach (var error in result.Item1.ValidationErrors) - { - Console.WriteLine($"Column: {error.ColumnName} | Row: {error.RowIndex} | Message: {error.ErrorMessage}"); - } - Console.WriteLine($"Mapped {result.Item1.ParsedModels.Count} models in {result.Item2.ToString()} " + - $"with {result.Item1.ValidationErrors.Count} validation errors"); - Console.WriteLine("==============================================================="); - } - } +using System; +using SheetToObjects.Adapters.MicrosoftExcel; +using SheetToObjects.Core; +using SheetToObjects.Examples.Models; +using SheetToObjects.Lib; + +namespace SheetToObjects.Examples +{ + public class ExcelApp + { + private readonly IProvideSheet _sheetProvider; + private readonly IMapSheetToObjects _sheetMapper; + + public ExcelApp( + IProvideSheet sheetProvider, + IMapSheetToObjects sheetMapper) + { + _sheetProvider = sheetProvider; + _sheetMapper = sheetMapper; + } + + public void Run() + { + var result = Timer.TimeFunc(() => + { + var excelRange = new ExcelRange(new ExcelCell("A", 1), new ExcelCell("U", 9995)); + var sheet = _sheetProvider.GetFromPath(@"./Files/Sample - Superstore.xlsx", "orders", excelRange); + + return _sheetMapper.Map(sheet); + }); + + foreach (var error in result.Item1.ValidationErrors) + { + Console.WriteLine($"Column: {error.ColumnName} | Row: {error.RowIndex} | Message: {error.ErrorMessage}"); + } + Console.WriteLine($"Mapped {result.Item1.ParsedModels.Count} models in {result.Item2.ToString()} " + + $"with {result.Item1.ValidationErrors.Count} validation errors"); + Console.WriteLine("==============================================================="); + } + } } \ No newline at end of file diff --git a/src/SheetToObjects.ConsoleApp/Files/Sample - Superstore.xlsx b/src/SheetToObjects.Examples/Files/Sample - Superstore.xlsx similarity index 100% rename from src/SheetToObjects.ConsoleApp/Files/Sample - Superstore.xlsx rename to src/SheetToObjects.Examples/Files/Sample - Superstore.xlsx diff --git a/src/SheetToObjects.ConsoleApp/Files/profiles-with-validation-errors.csv b/src/SheetToObjects.Examples/Files/profiles-with-validation-errors.csv similarity index 100% rename from src/SheetToObjects.ConsoleApp/Files/profiles-with-validation-errors.csv rename to src/SheetToObjects.Examples/Files/profiles-with-validation-errors.csv diff --git a/src/SheetToObjects.ConsoleApp/Files/profiles-without-validation-errors.csv b/src/SheetToObjects.Examples/Files/profiles-without-validation-errors.csv similarity index 100% rename from src/SheetToObjects.ConsoleApp/Files/profiles-without-validation-errors.csv rename to src/SheetToObjects.Examples/Files/profiles-without-validation-errors.csv diff --git a/src/SheetToObjects.ConsoleApp/Files/profiles.xlsx b/src/SheetToObjects.Examples/Files/profiles.xlsx similarity index 100% rename from src/SheetToObjects.ConsoleApp/Files/profiles.xlsx rename to src/SheetToObjects.Examples/Files/profiles.xlsx diff --git a/src/SheetToObjects.ConsoleApp/GoogleSheetsApp.cs b/src/SheetToObjects.Examples/GoogleSheetsApp.cs similarity index 93% rename from src/SheetToObjects.ConsoleApp/GoogleSheetsApp.cs rename to src/SheetToObjects.Examples/GoogleSheetsApp.cs index 284e6e0..46da62e 100644 --- a/src/SheetToObjects.ConsoleApp/GoogleSheetsApp.cs +++ b/src/SheetToObjects.Examples/GoogleSheetsApp.cs @@ -1,48 +1,48 @@ -using System; -using System.Threading.Tasks; -using Microsoft.Extensions.Options; -using SheetToObjects.Adapters.GoogleSheets; -using SheetToObjects.ConsoleApp.Models; -using SheetToObjects.Core; -using SheetToObjects.Lib; - -namespace SheetToObjects.ConsoleApp -{ - public class GoogleSheetsApp - { - private readonly AppSettings _appSettings; - private readonly IProvideSheet _sheetProvider; - private readonly IMapSheetToObjects _sheetMapper; - - public GoogleSheetsApp( - IOptions appSettings, - IProvideSheet sheetProvider, - IMapSheetToObjects sheetMapper) - { - _appSettings = appSettings.Value; - _sheetProvider = sheetProvider; - _sheetMapper = sheetMapper; - } - - public async Task Run() - { - var result = await Timer.TimeFuncAsync(async () => - { - var sheet = await _sheetProvider.GetAsync( - _appSettings.SheetId, - "'Herstructurering Filters Data'!A1:H9", - _appSettings.ApiKey); - - return _sheetMapper.Map(sheet); - }); - - foreach (var error in result.Item1.ValidationErrors) - { - Console.WriteLine($"Column: {error.ColumnName} | Row: {error.RowIndex} | Message: {error.ErrorMessage}"); - } - Console.WriteLine($"Mapped {result.Item1.ParsedModels.Count} models in {result.Item2.ToString()} " + - $"with {result.Item1.ValidationErrors.Count} validation errors"); - Console.WriteLine("==============================================================="); - } - } +using System; +using System.Threading.Tasks; +using Microsoft.Extensions.Options; +using SheetToObjects.Adapters.GoogleSheets; +using SheetToObjects.Core; +using SheetToObjects.Examples.Models; +using SheetToObjects.Lib; + +namespace SheetToObjects.Examples +{ + public class GoogleSheetsApp + { + private readonly AppSettings _appSettings; + private readonly IProvideSheet _sheetProvider; + private readonly IMapSheetToObjects _sheetMapper; + + public GoogleSheetsApp( + IOptions appSettings, + IProvideSheet sheetProvider, + IMapSheetToObjects sheetMapper) + { + _appSettings = appSettings.Value; + _sheetProvider = sheetProvider; + _sheetMapper = sheetMapper; + } + + public async Task Run() + { + var result = await Timer.TimeFuncAsync(async () => + { + var sheet = await _sheetProvider.GetAsync( + _appSettings.SheetId, + "'Herstructurering Filters Data'!A1:H9", + _appSettings.ApiKey); + + return _sheetMapper.Map(sheet); + }); + + foreach (var error in result.Item1.ValidationErrors) + { + Console.WriteLine($"Column: {error.ColumnName} | Row: {error.RowIndex} | Message: {error.ErrorMessage}"); + } + Console.WriteLine($"Mapped {result.Item1.ParsedModels.Count} models in {result.Item2.ToString()} " + + $"with {result.Item1.ValidationErrors.Count} validation errors"); + Console.WriteLine("==============================================================="); + } + } } \ No newline at end of file diff --git a/src/SheetToObjects.ConsoleApp/Models/EpicTracking.cs b/src/SheetToObjects.Examples/Models/EpicTracking.cs similarity index 90% rename from src/SheetToObjects.ConsoleApp/Models/EpicTracking.cs rename to src/SheetToObjects.Examples/Models/EpicTracking.cs index 721fb42..56dc2fb 100644 --- a/src/SheetToObjects.ConsoleApp/Models/EpicTracking.cs +++ b/src/SheetToObjects.Examples/Models/EpicTracking.cs @@ -1,4 +1,4 @@ -namespace SheetToObjects.ConsoleApp.Models +namespace SheetToObjects.Examples.Models { public class EpicTracking { diff --git a/src/SheetToObjects.ConsoleApp/Models/Profile.cs b/src/SheetToObjects.Examples/Models/Profile.cs similarity index 97% rename from src/SheetToObjects.ConsoleApp/Models/Profile.cs rename to src/SheetToObjects.Examples/Models/Profile.cs index 54e4fbd..9f615bd 100644 --- a/src/SheetToObjects.ConsoleApp/Models/Profile.cs +++ b/src/SheetToObjects.Examples/Models/Profile.cs @@ -3,7 +3,7 @@ using SheetToObjects.Lib.AttributesConfiguration.MappingTypeAttributes; using SheetToObjects.Lib.AttributesConfiguration.RuleAttributes; -namespace SheetToObjects.ConsoleApp.Models +namespace SheetToObjects.Examples.Models { [SheetToObjectAttributeConfig(true)] diff --git a/src/SheetToObjects.ConsoleApp/Models/Superstore.cs b/src/SheetToObjects.Examples/Models/Superstore.cs similarity index 96% rename from src/SheetToObjects.ConsoleApp/Models/Superstore.cs rename to src/SheetToObjects.Examples/Models/Superstore.cs index d76723a..a804365 100644 --- a/src/SheetToObjects.ConsoleApp/Models/Superstore.cs +++ b/src/SheetToObjects.Examples/Models/Superstore.cs @@ -1,6 +1,6 @@ using System; -namespace SheetToObjects.ConsoleApp.Models +namespace SheetToObjects.Examples.Models { public class Superstore { diff --git a/src/SheetToObjects.ConsoleApp/Program.cs b/src/SheetToObjects.Examples/Program.cs similarity index 95% rename from src/SheetToObjects.ConsoleApp/Program.cs rename to src/SheetToObjects.Examples/Program.cs index 311f547..9eff0e1 100644 --- a/src/SheetToObjects.ConsoleApp/Program.cs +++ b/src/SheetToObjects.Examples/Program.cs @@ -1,64 +1,64 @@ -using System; -using System.Threading.Tasks; -using Microsoft.Extensions.DependencyInjection; - -namespace SheetToObjects.ConsoleApp -{ - internal class Program - { - private static ServiceProvider _services; - - private static void Main() - { - _services = new ServiceCollection().ConfigureServices().BuildServiceProvider(); - - RunGoogleSheetsExampleAsync().GetAwaiter().GetResult(); - RunProtectedGoogleSheetsExampleAsync().GetAwaiter().GetResult(); - RunExcelExample(); - RunCsvWithValidationErrorsExample(); - RunCsvWithoutValidationErrorsExample(); - - Console.ReadLine(); - } - - private static async Task RunGoogleSheetsExampleAsync() - { - Console.WriteLine("==============================================================="); - Console.WriteLine("Running Google Sheets example"); - - await _services.GetService().Run(); +using System; +using System.Threading.Tasks; +using Microsoft.Extensions.DependencyInjection; + +namespace SheetToObjects.Examples +{ + internal class Program + { + private static ServiceProvider _services; + + private static void Main() + { + _services = new ServiceCollection().ConfigureServices().BuildServiceProvider(); + + RunGoogleSheetsExampleAsync().GetAwaiter().GetResult(); + RunProtectedGoogleSheetsExampleAsync().GetAwaiter().GetResult(); + RunExcelExample(); + RunCsvWithValidationErrorsExample(); + RunCsvWithoutValidationErrorsExample(); + + Console.ReadLine(); + } + + private static async Task RunGoogleSheetsExampleAsync() + { + Console.WriteLine("==============================================================="); + Console.WriteLine("Running Google Sheets example"); + + await _services.GetService().Run(); } private static async Task RunProtectedGoogleSheetsExampleAsync() - { - Console.WriteLine("==============================================================="); + { + Console.WriteLine("==============================================================="); Console.WriteLine("Running Protected Google Sheets example"); await _services.GetService().Run(); - } - - private static void RunExcelExample() - { - Console.WriteLine("==============================================================="); - Console.WriteLine("Running Excel example"); - - _services.GetService().Run(); - } - - private static void RunCsvWithValidationErrorsExample() - { - Console.WriteLine("==============================================================="); - Console.WriteLine("Running CSV with validation errors example"); - - _services.GetService().Run(); - } - - private static void RunCsvWithoutValidationErrorsExample() - { - Console.WriteLine("==============================================================="); - Console.WriteLine("Running CSV without validation errors example"); - - _services.GetService().Run(); - } - } -} + } + + private static void RunExcelExample() + { + Console.WriteLine("==============================================================="); + Console.WriteLine("Running Excel example"); + + _services.GetService().Run(); + } + + private static void RunCsvWithValidationErrorsExample() + { + Console.WriteLine("==============================================================="); + Console.WriteLine("Running CSV with validation errors example"); + + _services.GetService().Run(); + } + + private static void RunCsvWithoutValidationErrorsExample() + { + Console.WriteLine("==============================================================="); + Console.WriteLine("Running CSV without validation errors example"); + + _services.GetService().Run(); + } + } +} diff --git a/src/SheetToObjects.ConsoleApp/ProtectedGoogleSheetsApp.cs b/src/SheetToObjects.Examples/ProtectedGoogleSheetsApp.cs similarity index 93% rename from src/SheetToObjects.ConsoleApp/ProtectedGoogleSheetsApp.cs rename to src/SheetToObjects.Examples/ProtectedGoogleSheetsApp.cs index e3d079a..81c5aca 100644 --- a/src/SheetToObjects.ConsoleApp/ProtectedGoogleSheetsApp.cs +++ b/src/SheetToObjects.Examples/ProtectedGoogleSheetsApp.cs @@ -1,44 +1,44 @@ -using System; -using System.Threading.Tasks; -using SheetToObjects.Adapters.ProtectedGoogleSheets; -using SheetToObjects.ConsoleApp.Models; -using SheetToObjects.Core; -using SheetToObjects.Lib; - -namespace SheetToObjects.ConsoleApp -{ - public class ProtectedGoogleSheetsApp - { - private readonly IProvideSheet _sheetProvider; - private readonly IMapSheetToObjects _sheetMapper; - - public ProtectedGoogleSheetsApp( - IProvideSheet sheetProvider, - IMapSheetToObjects sheetMapper) - { - _sheetProvider = sheetProvider; - _sheetMapper = sheetMapper; - } - - public async Task Run() - { - var result = await Timer.TimeFuncAsync(async () => - { - var sheet = await _sheetProvider.GetAsync("SheetToObjects-a96682815641.json", - "SheetToObjects demo", - "1cxAOIdNlb2UJ8h5ADUyqiolQt7znf-S7AAEKJV8VpJc", - "'store'!A1:U9995"); - - return _sheetMapper.Map(sheet); - }); - - foreach (var error in result.Item1.ValidationErrors) - { - Console.WriteLine($"Column: {error.ColumnName} | Row: {error.RowIndex} | Message: {error.ErrorMessage}"); - } - Console.WriteLine($"Mapped {result.Item1.ParsedModels.Count} models in {result.Item2.ToString()} " + - $"with {result.Item1.ValidationErrors.Count} validation errors"); - Console.WriteLine("==============================================================="); - } - } -} +using System; +using System.Threading.Tasks; +using SheetToObjects.Adapters.ProtectedGoogleSheets; +using SheetToObjects.Core; +using SheetToObjects.Examples.Models; +using SheetToObjects.Lib; + +namespace SheetToObjects.Examples +{ + public class ProtectedGoogleSheetsApp + { + private readonly IProvideSheet _sheetProvider; + private readonly IMapSheetToObjects _sheetMapper; + + public ProtectedGoogleSheetsApp( + IProvideSheet sheetProvider, + IMapSheetToObjects sheetMapper) + { + _sheetProvider = sheetProvider; + _sheetMapper = sheetMapper; + } + + public async Task Run() + { + var result = await Timer.TimeFuncAsync(async () => + { + var sheet = await _sheetProvider.GetAsync("SheetToObjects-a96682815641.json", + "SheetToObjects demo", + "1cxAOIdNlb2UJ8h5ADUyqiolQt7znf-S7AAEKJV8VpJc", + "'store'!A1:U9995"); + + return _sheetMapper.Map(sheet); + }); + + foreach (var error in result.Item1.ValidationErrors) + { + Console.WriteLine($"Column: {error.ColumnName} | Row: {error.RowIndex} | Message: {error.ErrorMessage}"); + } + Console.WriteLine($"Mapped {result.Item1.ParsedModels.Count} models in {result.Item2.ToString()} " + + $"with {result.Item1.ValidationErrors.Count} validation errors"); + Console.WriteLine("==============================================================="); + } + } +} diff --git a/src/SheetToObjects.ConsoleApp/ServiceConfigurator.cs b/src/SheetToObjects.Examples/ServiceConfigurator.cs similarity index 95% rename from src/SheetToObjects.ConsoleApp/ServiceConfigurator.cs rename to src/SheetToObjects.Examples/ServiceConfigurator.cs index 4f8fbbe..a4a96ab 100644 --- a/src/SheetToObjects.ConsoleApp/ServiceConfigurator.cs +++ b/src/SheetToObjects.Examples/ServiceConfigurator.cs @@ -1,38 +1,38 @@ -using System.IO; -using System.Reflection; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.DependencyInjection; -using SheetToObjects.Extensions.Microsoft.DependencyInjection; - -namespace SheetToObjects.ConsoleApp -{ - public static class ServiceConfigurator - { - public static IServiceCollection ConfigureServices(this IServiceCollection serviceCollection) - { - serviceCollection.AddTransient(); - serviceCollection.AddTransient(); - serviceCollection.AddTransient(); - serviceCollection.AddTransient(); - - serviceCollection.AddSheetToObjects(Assembly.GetExecutingAssembly()); - - serviceCollection.AddOptions(); - - var configuration = new ConfigurationBuilder() - .SetBasePath(Directory.GetCurrentDirectory()) - .AddJsonFile("app-settings.json", false) - .Build(); - - serviceCollection.Configure(configuration.GetSection("Configuration")); - - serviceCollection.AddTransient(); - serviceCollection.AddTransient(); - serviceCollection.AddTransient(); - serviceCollection.AddTransient(); - serviceCollection.AddTransient(); - - return serviceCollection; - } - } -} +using System.IO; +using System.Reflection; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; +using SheetToObjects.Extensions.Microsoft.DependencyInjection; + +namespace SheetToObjects.Examples +{ + public static class ServiceConfigurator + { + public static IServiceCollection ConfigureServices(this IServiceCollection serviceCollection) + { + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + + serviceCollection.AddSheetToObjects(Assembly.GetExecutingAssembly()); + + serviceCollection.AddOptions(); + + var configuration = new ConfigurationBuilder() + .SetBasePath(Directory.GetCurrentDirectory()) + .AddJsonFile("app-settings.json", false) + .Build(); + + serviceCollection.Configure(configuration.GetSection("Configuration")); + + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + + return serviceCollection; + } + } +} diff --git a/src/SheetToObjects.ConsoleApp/SheetToObjectConfigs/EpicTrackingConfig.cs b/src/SheetToObjects.Examples/SheetToObjectConfigs/EpicTrackingConfig.cs similarity index 90% rename from src/SheetToObjects.ConsoleApp/SheetToObjectConfigs/EpicTrackingConfig.cs rename to src/SheetToObjects.Examples/SheetToObjectConfigs/EpicTrackingConfig.cs index ddacc5c..dd60830 100644 --- a/src/SheetToObjects.ConsoleApp/SheetToObjectConfigs/EpicTrackingConfig.cs +++ b/src/SheetToObjects.Examples/SheetToObjectConfigs/EpicTrackingConfig.cs @@ -1,7 +1,7 @@ -using SheetToObjects.ConsoleApp.Models; +using SheetToObjects.Examples.Models; using SheetToObjects.Lib.FluentConfiguration; -namespace SheetToObjects.ConsoleApp.SheetToObjectConfigs +namespace SheetToObjects.Examples.SheetToObjectConfigs { public class EpicTrackingConfig : SheetToObjectConfig { diff --git a/src/SheetToObjects.ConsoleApp/SheetToObjectConfigs/SuperstoreConfig.cs b/src/SheetToObjects.Examples/SheetToObjectConfigs/SuperstoreConfig.cs similarity index 95% rename from src/SheetToObjects.ConsoleApp/SheetToObjectConfigs/SuperstoreConfig.cs rename to src/SheetToObjects.Examples/SheetToObjectConfigs/SuperstoreConfig.cs index 5da6850..659306f 100644 --- a/src/SheetToObjects.ConsoleApp/SheetToObjectConfigs/SuperstoreConfig.cs +++ b/src/SheetToObjects.Examples/SheetToObjectConfigs/SuperstoreConfig.cs @@ -1,7 +1,7 @@ -using SheetToObjects.ConsoleApp.Models; +using SheetToObjects.Examples.Models; using SheetToObjects.Lib.FluentConfiguration; -namespace SheetToObjects.ConsoleApp.SheetToObjectConfigs +namespace SheetToObjects.Examples.SheetToObjectConfigs { public class SuperstoreConfig : SheetToObjectConfig { diff --git a/src/SheetToObjects.ConsoleApp/SheetToObjects-a96682815641.json b/src/SheetToObjects.Examples/SheetToObjects-a96682815641.json similarity index 100% rename from src/SheetToObjects.ConsoleApp/SheetToObjects-a96682815641.json rename to src/SheetToObjects.Examples/SheetToObjects-a96682815641.json diff --git a/src/SheetToObjects.ConsoleApp/SheetToObjects.ConsoleApp.csproj b/src/SheetToObjects.Examples/SheetToObjects.Examples.csproj similarity index 97% rename from src/SheetToObjects.ConsoleApp/SheetToObjects.ConsoleApp.csproj rename to src/SheetToObjects.Examples/SheetToObjects.Examples.csproj index 109309a..1141d22 100644 --- a/src/SheetToObjects.ConsoleApp/SheetToObjects.ConsoleApp.csproj +++ b/src/SheetToObjects.Examples/SheetToObjects.Examples.csproj @@ -1,48 +1,48 @@ - - - - Exe - netcoreapp2.0 - - - - - - - - - - - - - - - - - - - - - Always - - - Always - - - Always - - - Always - - - Always - - - PreserveNewest - - - Always - - - - + + + + Exe + netcoreapp2.0 + + + + + + + + + + + + + + + + + + + + + Always + + + Always + + + Always + + + Always + + + Always + + + PreserveNewest + + + Always + + + + diff --git a/src/SheetToObjects.ConsoleApp/app-settings.default.json b/src/SheetToObjects.Examples/app-settings.default.json similarity index 95% rename from src/SheetToObjects.ConsoleApp/app-settings.default.json rename to src/SheetToObjects.Examples/app-settings.default.json index 0d15a3c..bbefe44 100644 --- a/src/SheetToObjects.ConsoleApp/app-settings.default.json +++ b/src/SheetToObjects.Examples/app-settings.default.json @@ -1,7 +1,7 @@ -{ - "Configuration": { - "GoogleSheetsUrl": "https://sheets.googleapis.com/v4", - "ApiKey": "", - "SheetId": "" - } +{ + "Configuration": { + "GoogleSheetsUrl": "https://sheets.googleapis.com/v4", + "ApiKey": "", + "SheetId": "" + } } \ No newline at end of file diff --git a/src/SheetToObjects.Examples/app-settings.json b/src/SheetToObjects.Examples/app-settings.json new file mode 100644 index 0000000..177ffa0 --- /dev/null +++ b/src/SheetToObjects.Examples/app-settings.json @@ -0,0 +1,6 @@ +{ + "Configuration": { + "ApiKey": "AIzaSyA4_t43xD9i59jhAqLNP7EogLW50Gohb_Y", + "SheetId": "1L0a1mo3MUoMvUitRtsajcAkcTSKQfBmbOEEh8jiv5uw" + } +} \ No newline at end of file diff --git a/src/SheetToObjects.sln b/src/SheetToObjects.sln index 6da16be..7f545b9 100644 --- a/src/SheetToObjects.sln +++ b/src/SheetToObjects.sln @@ -3,8 +3,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 VisualStudioVersion = 15.0.27428.2011 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SheetToObjects.ConsoleApp", "SheetToObjects.ConsoleApp\SheetToObjects.ConsoleApp.csproj", "{9A11189F-30E1-47C0-8B3D-D71810D784F4}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SheetToObjects.Specs", "SheetToObjects.Specs\SheetToObjects.Specs.csproj", "{71827426-699E-45C7-B964-B483AD76EACC}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SheetToObjects.Core", "SheetToObjects.Core\SheetToObjects.Core.csproj", "{FE4C9175-D211-43A8-81E3-36281D8C5036}" @@ -24,7 +22,9 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SheetToObjects.Adapters.ProtectedGoogleSheets", "SheetToObjects.Adapters.ProtectedGoogleSheets\SheetToObjects.Adapters.ProtectedGoogleSheets.csproj", "{C6EA22A6-873B-44BC-9C4E-AD01227FBDA0}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SheetToObjects.Extensions.Microsoft.DependencyInjection", "SheetToObjects.Extensions.Microsoft.DependencyInjection\SheetToObjects.Extensions.Microsoft.DependencyInjection.csproj", "{6019026B-A019-431D-92F9-01EECBDFA628}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SheetToObjects.Extensions.Microsoft.DependencyInjection", "SheetToObjects.Extensions.Microsoft.DependencyInjection\SheetToObjects.Extensions.Microsoft.DependencyInjection.csproj", "{6019026B-A019-431D-92F9-01EECBDFA628}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SheetToObjects.Examples", "SheetToObjects.Examples\SheetToObjects.Examples.csproj", "{9C87BF5C-C3C6-490A-BCC2-C1C6FE1340AB}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -32,10 +32,6 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {9A11189F-30E1-47C0-8B3D-D71810D784F4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {9A11189F-30E1-47C0-8B3D-D71810D784F4}.Debug|Any CPU.Build.0 = Debug|Any CPU - {9A11189F-30E1-47C0-8B3D-D71810D784F4}.Release|Any CPU.ActiveCfg = Release|Any CPU - {9A11189F-30E1-47C0-8B3D-D71810D784F4}.Release|Any CPU.Build.0 = Release|Any CPU {71827426-699E-45C7-B964-B483AD76EACC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {71827426-699E-45C7-B964-B483AD76EACC}.Debug|Any CPU.Build.0 = Debug|Any CPU {71827426-699E-45C7-B964-B483AD76EACC}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -68,6 +64,10 @@ Global {6019026B-A019-431D-92F9-01EECBDFA628}.Debug|Any CPU.Build.0 = Debug|Any CPU {6019026B-A019-431D-92F9-01EECBDFA628}.Release|Any CPU.ActiveCfg = Release|Any CPU {6019026B-A019-431D-92F9-01EECBDFA628}.Release|Any CPU.Build.0 = Release|Any CPU + {9C87BF5C-C3C6-490A-BCC2-C1C6FE1340AB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9C87BF5C-C3C6-490A-BCC2-C1C6FE1340AB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9C87BF5C-C3C6-490A-BCC2-C1C6FE1340AB}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9C87BF5C-C3C6-490A-BCC2-C1C6FE1340AB}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE