A collection of samples that demonstrate how to call the Google Cloud Spanner API from C#.
This sample requires .NET Core 2.0 or later. That means using Visual Studio 2017, or the command line. Visual Studio 2015 users can use this older sample.
-
Follow the instructions in the root README.
-
Enable APIs for your project. Click here to visit Cloud Platform Console and enable the Google Cloud Spanner API.
-
From a Powershell command line, run the QuickStart sample:
PS C:\...\dotnet-docs-samples\spanner\api\QuickStart> dotnet run Hello World -
And run the Spanner sample to see a list of subcommands:
PS C:\...\dotnet-docs-samples\spanner\api\Spanner> dotnet run Spanner 1.0.0.0 Copyright c 2017 ERROR(S): No verb selected. createDatabase Create a Spanner database in your project. createSampleDatabase Create a sample Spanner database along with sample tables in your project. insertSampleData Insert sample data into sample Spanner database table. querySampleData Query sample data from sample Spanner database table. addColumn Add a column to the sample Spanner database table. writeDataToNewColumn Write data to a newly added column in the sample Spanner database table. queryNewColumn Query data from a newly added column in the sample Spanner database table. queryDataWithTransaction Query the sample Spanner database table using a transaction. readWriteWithTransaction Update data in the sample Spanner database table using a read-write transaction. addIndex Add an index to the sample Spanner database table. queryDataWithIndex Query the sample Spanner database table using an index. addStoringIndex Add a storing index to the sample Spanner database table. queryDataWithStoringIndex Query the sample Spanner database table using an storing index. help Display more information on a specific command. version Display version information.PS > dotnet run createSampleDatabase your-project-id my-instance my-database Waiting for operation to complete... Database create operation state: Ready Operation status: RanToCompletion Created sample database my-database on instance my-instance
- See CONTRIBUTING.md
- See LICENSE
- See TESTING.md