Merge branch 'main' of github.com:eedalong/Apache-IoTDB-Client-CSharp into main
diff --git a/.asf.yaml b/.asf.yaml
new file mode 100644
index 0000000..20e2eae
--- /dev/null
+++ b/.asf.yaml
@@ -0,0 +1,42 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+
+notifications:
+ issues: reviews@iotdb.apache.org
+ pullrequests: reviews@iotdb.apache.org
+
+github:
+ description: "Apache IoTDB Client for C#"
+ homepage: https://iotdb.apache.org/
+ labels:
+ - timeseries
+ - iotdb
+ - csharp
+ features:
+ issues: true
+ enabled_merge_buttons:
+ # enable squash button:
+ squash: true
+ # enable merge button:
+ merge: true
+ # disable rebase button:
+ rebase: true
+ collaborators:
+ - lausannel
diff --git a/.gitmodules b/.gitmodules
deleted file mode 100644
index 7d7130b..0000000
--- a/.gitmodules
+++ /dev/null
@@ -1,3 +0,0 @@
-[submodule "Apache-IoTDB-Client-CSharp-UserCase"]
- path = Apache-IoTDB-Client-CSharp-UserCase
- url = git@github.com:eedalong/Apache-IoTDB-Client-CSharp-UserCase.git
diff --git a/Apache-IoTDB-Client-CSharp-UserCase b/Apache-IoTDB-Client-CSharp-UserCase
deleted file mode 160000
index a58a732..0000000
--- a/Apache-IoTDB-Client-CSharp-UserCase
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit a58a73217a6d7d3bf96aa6a306a8a2b8ca75c51d
diff --git a/Apache-IoTDB-Client-CSharp-UserCase/Apache-IoTDB-Client-CSharp-UserCase.csproj b/Apache-IoTDB-Client-CSharp-UserCase/Apache-IoTDB-Client-CSharp-UserCase.csproj
new file mode 100644
index 0000000..532250b
--- /dev/null
+++ b/Apache-IoTDB-Client-CSharp-UserCase/Apache-IoTDB-Client-CSharp-UserCase.csproj
@@ -0,0 +1,14 @@
+<Project Sdk="Microsoft.NET.Sdk">
+
+ <PropertyGroup>
+ <OutputType>Exe</OutputType>
+ <TargetFramework>net7.0</TargetFramework>
+ <RootNamespace>Apache_IoTDB_Client_CSharp_UserCase</RootNamespace>
+ <LangVersion>latest</LangVersion>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <PackageReference Include="Apache.IoTDB" Version="1.0.0.3" />
+ </ItemGroup>
+
+</Project>
\ No newline at end of file
diff --git a/Apache-IoTDB-Client-CSharp-UserCase/Program.cs b/Apache-IoTDB-Client-CSharp-UserCase/Program.cs
new file mode 100644
index 0000000..107931a
--- /dev/null
+++ b/Apache-IoTDB-Client-CSharp-UserCase/Program.cs
@@ -0,0 +1,102 @@
+using System;
+using System.Collections.Generic;
+using System.Threading;
+using System.Threading.Tasks;
+using Apache.IoTDB;
+using Apache.IoTDB.DataStructure;
+
+namespace Apache.IoTDB.UserCase
+{
+ class Program
+ {
+ static string host = "localhost";
+ static int port = 6667;
+ static int pool_size = 2;
+
+
+ static async Task OpenAndCloseSessionPool()
+ {
+ var session_pool = new SessionPool(host, port, pool_size);
+ await session_pool.Open(false);
+ if (session_pool.IsOpen())
+ {
+ Console.WriteLine("SessionPool open success");
+ }
+ else
+ {
+ Console.WriteLine("SessionPool open failed");
+ }
+ await session_pool.Close();
+ }
+
+ static async Task CreateTimeseries()
+ {
+ var session_pool = new SessionPool(host, port, pool_size);
+ await session_pool.Open(false);
+
+ await session_pool.DeleteStorageGroupAsync("root.ln.wf01.wt01");
+ var status = await session_pool.CreateTimeSeries("root.ln.wf01.wt01.status", TSDataType.BOOLEAN, TSEncoding.PLAIN, Compressor.SNAPPY);
+ status = await session_pool.CreateTimeSeries("root.ln.wf01.wt01.temperature", TSDataType.DOUBLE, TSEncoding.PLAIN, Compressor.SNAPPY);
+ status = await session_pool.CreateTimeSeries("root.ln.wf01.wt01.hardware", TSDataType.TEXT, TSEncoding.PLAIN, Compressor.SNAPPY);
+
+ await session_pool.Close();
+ }
+
+ static async Task InsertRecord()
+ {
+ var session_pool = new SessionPool(host, port, pool_size);
+ await session_pool.Open(false);
+ long timestamp = 1;
+ var values = new List<object> { true, (double)1.1, "test" };
+ var measures = new List<string> { "status", "temperature", "hardware" };
+ var rowRecord = new RowRecord(timestamp, values, measures);
+ var status = await session_pool.InsertRecordAsync("root.ln.wf01.wt01", rowRecord);
+
+ await session_pool.Close();
+ }
+
+ static async Task InsertTablet()
+ {
+ var session_pool = new SessionPool(host, port, pool_size);
+ await session_pool.Open(false);
+ var device_id = "root.ln.wf01.wt01";
+ var measurement_lst = new List<string> { "status", "temperature", "hardware" };
+ var value_lst = new List<List<object>>
+ {
+ new() {true, (double)1.1, "test"},
+ new() {false, (double)2.2, "test2"},
+ new() {true, (double)3.3, "test3"}
+ };
+ var timestamp_lst = new List<long> { 1, 2, 3 };
+ var datatype_lst = new List<TSDataType> { TSDataType.BOOLEAN, TSDataType.DOUBLE, TSDataType.TEXT };
+ var tablet = new Tablet(device_id, measurement_lst, datatype_lst, value_lst, timestamp_lst);
+ var status = await session_pool.InsertTabletAsync(tablet);
+ await session_pool.Close();
+ }
+
+ static async Task ExecuteQueryStatement()
+ {
+ var session_pool = new SessionPool(host, port, pool_size);
+ await session_pool.Open(false);
+ var res = await session_pool.ExecuteQueryStatementAsync("select * from root.ln.wf01.wt01");
+ res.ShowTableNames();
+ while (res.HasNext())
+ {
+ Console.WriteLine(res.Next());
+ }
+ await res.Close();
+ await session_pool.Close();
+ }
+
+ static async Task Main(string[] args)
+ {
+ await OpenAndCloseSessionPool();
+ await CreateTimeseries();
+ await InsertRecord();
+ await InsertTablet();
+ await ExecuteQueryStatement();
+ }
+ }
+
+}
+
diff --git a/Apache-IoTDB-Client-CSharp-UserCase/README.md b/Apache-IoTDB-Client-CSharp-UserCase/README.md
new file mode 100644
index 0000000..3799d3d
--- /dev/null
+++ b/Apache-IoTDB-Client-CSharp-UserCase/README.md
@@ -0,0 +1,16 @@
+# Apache-IoTDB-Client-CSharp-UseCase
+Use case for csharp client of Apache IoTDB
+
+
+# Run this use case
+
+After cloning this project, you need to install Apache.IoTDB first.
+
+```shell
+dotnet add package Apache.IoTDB
+```
+
+Then you can run this project to test.
+```shell
+dotnet run
+```
diff --git a/README.md b/README.md
index dba6398..b134037 100644
--- a/README.md
+++ b/README.md
@@ -41,7 +41,7 @@
dotnet add package Apache.IoTDB
```
-Note that the `Apache.IoTDB` package only supports versions greater than `.net framework 4.6.1`.(#starting-from-net-framework-4x).
+Note that the `Apache.IoTDB` package only supports versions greater than `.net framework 4.6.1`.
## Prerequisites
@@ -50,7 +50,9 @@
## How to Use the Client (Quick Start)
-Users can refer to the test code in [tests](https://github.com/eedalong/Apache-IoTDB-Client-CSharp-UserCase) to understand the usage mode of each interface.
+Users can quickly get started by referring to the use cases under the Apache-IoTDB-Client-CSharp-UserCase directory. These use cases serve as a useful resource for getting familiar with the client's functionality and capabilities.
+
+For those who wish to delve deeper into the client's usage and explore more advanced features, the samples directory contains additional code samples.
## Developer environment requirements for iotdb-client-csharp
@@ -68,5 +70,8 @@
### Command Line Tools
+* dotnet CLI
+* Thrift
+
## Publish your own client on nuget.org
You can find out how to publish from this [doc](./PUBLISH.md).
\ No newline at end of file
diff --git a/README_ZH.md b/README_ZH.md
index 37d3943..7a8216e 100644
--- a/README_ZH.md
+++ b/README_ZH.md
@@ -46,15 +46,19 @@
.NET Framework >= 4.6.1
## 如何使用 (快速上手)
-用户可参考[使用样例](https://github.com/eedalong/Apache-IoTDB-Client-CSharp-UserCase)中的测试代码了解各个接口使用方式
+用户可以通过参考Apache-IoTDB-Client-CSharp-UserCase目录下的用例快速入门。这些用例提供了客户端的基本功能和用法的参考。
+
+对于希望深入了解客户端用法并探索更高级特性的用户,samples目录包含了额外的代码示例。
## iotdb-client-csharp的开发者环境要求
- .NET SDK Version >= 5.0
- .NET Framework >= 4.6.1
- ApacheThrift >= 0.14.1
- NLog >= 4.7.9
+```
+.NET SDK Version >= 5.0
+.NET Framework >= 4.6.1
+ApacheThrift >= 0.14.1
+NLog >= 4.7.9
+```
### 操作系统
@@ -63,5 +67,8 @@
### 命令行工具
+* dotnet CLI
+* Thrift
+
## 在 nuget.org 上发布你自己的客户端
你可以在这个[文档](./PUBLISH.md)中找到如何发布
\ No newline at end of file