Amazon QLDB driver for .NET - Amazon Quantum Ledger Database (Amazon QLDB)

Amazon QLDB driver for .NET

To work with data in your ledger, you can connect to Amazon QLDB from your Microsoft .NET application by using an AWS provided driver. The driver targets .NET Standard 2.0. More specifically, it supports .NET Core (LTS) 2.1+ and .NET Framework 4.5.2+. For information on compatibility, see .NET Standard on the Microsoft Docs site.

We highly recommend using the Ion object mapper to completely bypass the need to manually convert between Amazon Ion types and native C# types.

The following topics describe how to get started with the QLDB driver for .NET.

Driver resources

For more information about the functionality supported by the .NET driver, see the following resources:

Prerequisites

Before you get started with the QLDB driver for .NET, you must do the following:

  1. Follow the AWS setup instructions in Accessing Amazon QLDB. This includes the following:

    1. Sign up for AWS.

    2. Create an AWS Identity and Access Management (IAM) user with the appropriate QLDB permissions.

    3. Get an IAM access key for development.

  2. Download and install the .NET Core SDK version 2.1 or later from the Microsoft .NET downloads site.

  3. (Optional) Install an integrated development environment (IDE) of your choice, such as Visual Studio, Visual Studio for Mac, or Visual Studio Code. You can download these from the Microsoft Visual Studio site.

  4. Configure your development environment for the AWS SDK for .NET:

    1. Set up your AWS credentials. We recommend creating a shared credentials file.

      For instructions, see Configuring AWS credentials using a credentials file in the AWS SDK for .NET Developer Guide.

    2. Set your default AWS Region. To learn how, see AWS Region selection.

      For a complete list of available Regions, see Amazon QLDB endpoints and quotas in the AWS General Reference.

Next, you can set up a basic sample application and run short code examples—or you can install the driver in an existing .NET project.

  • To install the QLDB driver and the AWS SDK for .NET in an existing project, proceed to Installation.

  • To set up a project and run short code examples that demonstrate basic data transactions on a ledger, see the Quick start tutorial.

Installation

Use the NuGet package manager to install the QLDB driver for .NET. We recommend using Visual Studio or an IDE of your choice to add project dependencies. The driver package name is Amazon.QLDB.Driver.

For example in Visual Studio, open the NuGet Package Manager Console on the Tools menu. Then, enter the following command at the PM> prompt.

PM> Install-Package Amazon.QLDB.Driver

Installing the driver also installs its dependencies, including the AWS SDK for .NET and Amazon Ion packages.

Install the Ion object mapper

Version 1.3.0 of the QLDB driver for .NET introduces support for accepting and returning native C# data types without the need to work with Amazon Ion. To use this feature, add the following package to your project.

  • Amazon.QLDB.Driver.Serialization – A library that can map Ion values to C# plain old CLR objects (POCO), and the other way around. This Ion object mapper lets your application interact directly with native C# data types without the need to work with Ion. For a short guide on how to use this library, see the SERIALIZATION.md file in the GitHub repository awslabs/amazon-qldb-driver-dotnet.

To install this package, enter the following command.

PM> Install-Package Amazon.QLDB.Driver.Serialization

For short code examples of how to run basic data transactions on a ledger, see the Cookbook reference.