diff --git a/.editorconfig b/.editorconfig index 8557580..ac1fa8a 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,5 +1,4 @@ -; This file is for unifying the coding style for different editors and IDEs. -; More information at http://EditorConfig.org +# EditorConfig is awesome: https://EditorConfig.org root = true @@ -23,5 +22,5 @@ indent_size = 4 indent_style = space indent_size = 2 -[tools/packages.config] +[*.sh] end_of_line = LF diff --git a/.gitattributes b/.gitattributes index 662ceee..e0e5e61 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,2 +1,4 @@ -tools/packages.config eol=lf +bootstrap.sh eol=lf + *.ps1 linguist-vendored +*.sh linguist-vendored diff --git a/.gitignore b/.gitignore index ca3f37f..360d74d 100644 --- a/.gitignore +++ b/.gitignore @@ -10,9 +10,9 @@ bin/ # Cake -tools/* -!tools/packages.config +tools/ +artifacts/ -# Build +# Visual Studio -artifacts/ +.vs/ diff --git a/GitVersion.yml b/GitVersion.yml index a43091c..f864959 100644 --- a/GitVersion.yml +++ b/GitVersion.yml @@ -1,5 +1,5 @@ branches: - feature[/-]: + feature: mode: ContinuousDeployment ignore: sha: [] diff --git a/README.md b/README.md index c8f0f78..6ade327 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ | CI | Status | Platform(s) | Framework(s) | Test Framework(s) | | --- | --- | --- | --- | --- | -| [AppVeyor][app-veyor] | [![Build Status][app-veyor-shield]][app-veyor] | `Windows` | `nestandard2.0` | `netcoreapp2.2.0` | +| [AppVeyor][app-veyor] | [![Build Status][app-veyor-shield]][app-veyor] | `Windows` | `nestandard2.0` | `netcoreapp2.2.2` | [Azure Table storage][table-storage] supports a [limited set of data types][supported-types] (namely `byte[]`, `bool`, `DateTime`, `double`, `Guid`, `int`, `long` and `string`). `Unsupported Types` allows to store unsupported data types with some limitations: @@ -58,6 +58,30 @@ You will not be able to [filter][filter] the entities using the unsupported type Each read and write to `Azure Table storage` will trigger the use of `Reflection`. This could be improved by caching the unsupported properties, in this case the scan would happen once per application lifetime. +## Running locally + +### Pre-requisites + +- [.NET Core SDK v2.2.104][dotnet-sdk] and higher + +### Initial setup on Windows + +```posh +.\bootstrap.ps1 +``` + +### Initial setup on Linux / OS X + +```bash +./bootstrap.sh +``` + +### Run build script + +```bash +dotnet cake build.cake +``` + [table-storage]: https://docs.microsoft.com/en-au/azure/cosmos-db/table-storage-overview [supported-types]: https://docs.microsoft.com/en-us/rest/api/storageservices/understanding-the-table-service-data-model#property-types [property-limitations]: https://docs.microsoft.com/en-us/rest/api/storageservices/understanding-the-table-service-data-model#property-limitations @@ -74,3 +98,4 @@ Each read and write to `Azure Table storage` will trigger the use of `Reflection [create-storage-account]: https://docs.microsoft.com/en-us/azure/storage/common/storage-quickstart-create-account?tabs=portal [console-screenshot]: docs/console.png [storage-screenshot]: docs/storage.png +[dotnet-sdk]: https://dotnet.microsoft.com/download diff --git a/appveyor.yml b/appveyor.yml index 4a12d02..2f7d768 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -5,7 +5,8 @@ branches: # We'll also build whenever there is a new commit on any branch starting with `features/` - /features\/.+/ build_script: - - ps: .\build.ps1 -pack + - ps: dotnet cake build.cake --bootstrap + - ps: dotnet cake build.cake --pack assembly_info: # We'll version the binaries and the NuGet package in the build script patch: false @@ -50,7 +51,7 @@ deploy: api_key: # Encrypted `NuGet.org` token - https://www.nuget.org/account/ApiKeys # https://www.appveyor.com/docs/deployment/nuget/#provider-settings - secure: Jg1y1vouDaU+CAzM8epKanv9lEGZZ3lpLEEhNMMfX/00V8/P3UtvYnI2aOO32kFx + secure: gO++14gsWVOdYLR/xQcXJNuzWXSeiZ6PCpKWZf0uugkKTtDCAQ8Galxk4QGrSh5p skip_symbols: false symbol_server: https://nuget.smbsrc.net/ artifact: packages @@ -73,12 +74,8 @@ environment: DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true # `install` will run before `build_script` install: - # `dotnet-install.ps1` is available at: https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-install-script - # `Cake.dll` is targeting `.NET Core` `1.0.9`, so we need to install the latest `1.0.x` runtime - # The runtime is required to run a `.NET Core` application, it's part of the `SDK` - # https://github.com/dotnet/core/blob/master/release-notes/download-archive.md - - ps: .\build\dotnet-install.ps1 -SharedRuntime -Version 1.0.9 - # `UnsupportedTypes` is targeting `.NET Core` `2.1`, so we can safely install the latest `SDK` + # Cake build is targeting `.NET Core` `2.2.0`, so we can safely install the latest `SDK` # The `SDK` is required to restore, build, publish... a `.NET Core` application # https://www.microsoft.com/net/download/windows - - ps: .\build\dotnet-install.ps1 -Channel Current + - ps: .\build\dotnet-install.ps1 -Channel 2.2 -Version 2.2.104 + - ps: dotnet tool install --global Cake.Tool --version 0.31.0 diff --git a/bootstrap.ps1 b/bootstrap.ps1 new file mode 100644 index 0000000..a880ec0 --- /dev/null +++ b/bootstrap.ps1 @@ -0,0 +1,3 @@ +dotnet tool install Cake.Tool --global --version 0.31.0 +dotnet cake build.cake --bootstrap +dotnet cake build.cake diff --git a/bootstrap.sh b/bootstrap.sh new file mode 100644 index 0000000..a880ec0 --- /dev/null +++ b/bootstrap.sh @@ -0,0 +1,3 @@ +dotnet tool install Cake.Tool --global --version 0.31.0 +dotnet cake build.cake --bootstrap +dotnet cake build.cake diff --git a/build.cake b/build.cake index af47cea..ef06d09 100644 --- a/build.cake +++ b/build.cake @@ -1,4 +1,6 @@ -#tool "nuget:?package=GitVersion.CommandLine&version=3.6.5" +#module nuget:?package=Cake.DotNetTool.Module&version=0.1.0 + +#tool dotnet:?package=GitVersion.Tool&version=4.0.1-beta1-58 var target = Argument("target", "Default"); var configuration = Argument("configuration", "Release"); diff --git a/samples/SampleConsole/Configuration/ServiceCollectionExtensions.cs b/samples/SampleConsole/Configuration/ServiceCollectionExtensions.cs index 4346104..6f28927 100644 --- a/samples/SampleConsole/Configuration/ServiceCollectionExtensions.cs +++ b/samples/SampleConsole/Configuration/ServiceCollectionExtensions.cs @@ -1,8 +1,11 @@ -using System.Threading.Tasks; +using System; +using System.Threading.Tasks; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Microsoft.WindowsAzure.Storage; +using Microsoft.WindowsAzure.Storage.RetryPolicies; +using Microsoft.WindowsAzure.Storage.Table; using TableStorage.UnsupportedTypes.SampleConsole.Storage; namespace TableStorage.UnsupportedTypes.SampleConsole.Configuration @@ -22,7 +25,13 @@ public static async Task AddStorageAsync(this IServiceCollection services, IConf var tableClient = storageAccount.CreateCloudTableClient(); var table = tableClient.GetTableReference(nameof(UnsupportedTypesTestTableEntity)); - await table.CreateIfNotExistsAsync(); + var options = new TableRequestOptions + { + RetryPolicy = new NoRetry(), + ServerTimeout = TimeSpan.FromSeconds(1) + }; + + await table.CreateIfNotExistsAsync(options, new OperationContext()); services.AddSingleton(table); } diff --git a/samples/SampleConsole/Properties/launchSettings.json b/samples/SampleConsole/Properties/launchSettings.json new file mode 100644 index 0000000..8a92dc3 --- /dev/null +++ b/samples/SampleConsole/Properties/launchSettings.json @@ -0,0 +1,8 @@ +{ + "$schema": "http://json.schemastore.org/launchsettings.json", + "profiles": { + "SampleConsole": { + "commandName": "Project" + } + } +} diff --git a/samples/SampleConsole/SampleConsole.csproj b/samples/SampleConsole/SampleConsole.csproj index 5d0f43f..fc15da6 100644 --- a/samples/SampleConsole/SampleConsole.csproj +++ b/samples/SampleConsole/SampleConsole.csproj @@ -2,6 +2,7 @@ Exe netcoreapp2.2 + 2.2.2 TableStorage.UnsupportedTypes.SampleConsole TableStorage.UnsupportedTypes.SampleConsole 7.1 @@ -22,7 +23,7 @@ - + diff --git a/tests/TableStorage.UnsupportedTypes.Tests/TableStorage.UnsupportedTypes.Tests.csproj b/tests/TableStorage.UnsupportedTypes.Tests/TableStorage.UnsupportedTypes.Tests.csproj index 1822004..1e76c91 100644 --- a/tests/TableStorage.UnsupportedTypes.Tests/TableStorage.UnsupportedTypes.Tests.csproj +++ b/tests/TableStorage.UnsupportedTypes.Tests/TableStorage.UnsupportedTypes.Tests.csproj @@ -1,11 +1,11 @@  netcoreapp2.2 - 2.2.0 + 2.2.2 false - + diff --git a/tools/packages.config b/tools/packages.config deleted file mode 100644 index 24d629f..0000000 --- a/tools/packages.config +++ /dev/null @@ -1,4 +0,0 @@ - - - -