Getting Started with ScalarDB Cluster SQL via .NET and LINQ
This tutorial describes how to create a sample application that uses ScalarDB Cluster SQL through LINQ.
Overview​
This tutorial illustrates the process of creating a sample e-commerce application, where items can be ordered and paid for with a line of credit by using ScalarDB.
Since the focus of the sample application is to demonstrate using ScalarDB, application-specific error handling, authentication processing, and similar functions are not included in the sample application. For details about exception handling, see Exception Handling in the ScalarDB Cluster .NET Client SDK.
The following diagram shows the system architecture of the sample application:
What you can do in this sample application​
The sample application supports the following types of transactions:
- Get customer information.
- Place an order by using a line of credit.
- Checks if the cost of the order is below the customer's credit limit.
- If the check passes, records the order history and updates the amount the customer has spent.
- Get order information by order ID.
- Get order information by customer ID.
- Make a payment.
- Reduces the amount the customer has spent.
Prerequisites for this sample application​
- .NET SDK 8.0
- ScalarDB Cluster running on a Kubernetes cluster
- We assume that you have a ScalarDB Cluster running on a Kubernetes cluster that you deployed by following the instructions in How to Deploy ScalarDB Cluster Locally.
.NET SDK 8.0 is the version used to create the sample application. For information about all supported versions, see Requirements
Set up ScalarDB Cluster​
The following sections describe how to set up the sample e-commerce application.
Clone the ScalarDB samples repository​
Open Terminal, then clone the ScalarDB samples repository by running the following command:
git clone https://github.com/scalar-labs/scalardb-samples
Then, go to the directory that contains the sample application by running the following command:
cd scalardb-samples/scalardb-dotnet-samples/scalardb-cluster-linq-sample
Update the referenced version of the ScalarDB.Client package​
To use ScalarDB Cluster, open ScalarDbClusterSample.csproj in your preferred text editor. Then, update the version of the referenced ScalarDB.Client package, replacing <MAJOR>.<MINOR> with the version of the deployed ScalarDB Cluster:
<PackageReference Include="ScalarDB.Client" Version="<MAJOR>.<MINOR>.*" />