Skip to content

Commit c7ac7de

Browse files
author
伯箫
committed
update to 4.0.0
1 parent 8f0429a commit c7ac7de

File tree

140 files changed

+37399
-2536
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

140 files changed

+37399
-2536
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ packages
22
*\bin
33
*\obj
44
.vs
5+
.DS_Store

CHANGELOG.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,10 @@
1818
## 版本号:2.2.0 日期:2016/04/11
1919
### 变更内容
2020
- 连接池的默认连接个数从50调整到300
21-
- 新增conditional update功能
21+
- 新增conditional update功能
22+
23+
## 版本号 4.0.0 日期2018/09/07
24+
### 变更内容
25+
- 数据传输改为ProtocolBuffer加PlainBuffer
26+
- 支持自增列
27+
- 支持多版本

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Aliyun TableStore SDK for C#
1+
# Aliyun TableStore SDK for C#
22

33
[![Software License](https://img.shields.io/badge/license-apache2-brightgreen.svg)](LICENSE)
44
[![GitHub version](https://badge.fury.io/gh/aliyun%2Faliyun-tablestore-csharp-sdk.svg)](https://badge.fury.io/gh/aliyun%2Faliyun-tablestore-csharp-sdk)
@@ -9,7 +9,7 @@
99
- 阿里云表格存储是构建在阿里云飞天分布式系统之上的NoSQL数据存储服务,提供海量结构化数据的存储和实时访问。
1010

1111
## 版本
12-
- 当前版本:3.0.0
12+
- 当前版本:4.0.0
1313

1414
## 运行环境
1515
### Windows

sample/Config.cs

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,6 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
4-
using System.Text;
5-
using System.Threading.Tasks;
6-
using Aliyun.OTS;
7-
8-
namespace Aliyun.OTS.Samples
1+
namespace Aliyun.OTS.Samples
92
{
10-
internal class Config
3+
internal static class Config
114
{
125
public static string AccessKeyId = "<your access key id>";
136

@@ -26,9 +19,11 @@ public static OTSClient GetClient()
2619
return OtsClient;
2720
}
2821

29-
OTSClientConfig config = new OTSClientConfig(Endpoint, AccessKeyId, AccessKeySecret, InstanceName);
30-
config.OTSDebugLogHandler = null;
31-
config.OTSErrorLogHandler = null;
22+
OTSClientConfig config = new OTSClientConfig(Endpoint, AccessKeyId, AccessKeySecret, InstanceName)
23+
{
24+
OTSDebugLogHandler = null,
25+
OTSErrorLogHandler = null
26+
};
3227
OtsClient = new OTSClient(config);
3328
return OtsClient;
3429
}

sample/Program.cs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,27 +14,27 @@ static void Main(string[] args)
1414

1515
CreateTableSample.TableOperations();
1616

17-
//SingleRowReadWriteSample.PutRow();
18-
//SingleRowReadWriteSample.PutRowAsync();
17+
SingleRowReadWriteSample.PutRow();
18+
SingleRowReadWriteSample.PutRowAsync();
1919

20-
//SingleRowReadWriteSample.UpdateRow();
20+
SingleRowReadWriteSample.UpdateRow();
2121

22-
//SingleRowReadWriteSample.GetRow();
23-
//SingleRowReadWriteSample.GetRowWithFilter();
22+
SingleRowReadWriteSample.GetRow();
23+
SingleRowReadWriteSample.GetRowWithFilter();
2424

25-
//MultiRowReadWriteSample.BatchWriteRow();
25+
MultiRowReadWriteSample.BatchWriteRow();
2626

27-
//MultiRowReadWriteSample.GetRange();
28-
//MultiRowReadWriteSample.GetRangeWithFilter();
29-
//MultiRowReadWriteSample.GetIterator();
27+
MultiRowReadWriteSample.GetRange();
28+
MultiRowReadWriteSample.GetRangeWithFilter();
29+
MultiRowReadWriteSample.GetIterator();
3030

31-
//MultiRowReadWriteSample.BatchGetRow();
32-
//MultiRowReadWriteSample.BatchGetRowWithFilter();
31+
MultiRowReadWriteSample.BatchGetRow();
32+
MultiRowReadWriteSample.BatchGetRowWithFilter();
3333

34-
//ConditionUpdateSample.ConditionPutRow();
35-
//ConditionUpdateSample.ConditionUpdateRow();
36-
//ConditionUpdateSample.ConditionDeleteRow();
37-
//ConditionUpdateSample.ConditionBatchWriteRow();
34+
ConditionUpdateSample.ConditionPutRow();
35+
ConditionUpdateSample.ConditionUpdateRow();
36+
ConditionUpdateSample.ConditionDeleteRow();
37+
ConditionUpdateSample.ConditionBatchWriteRow();
3838
}
3939
catch (OTSClientException ex)
4040
{

sample/Samples/ConditionUpdateSample.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public static void ConditionPutRow()
6767
try
6868
{
6969
request.Condition.ColumnCondition = new RelationalCondition("col0",
70-
RelationalCondition.CompareOperator.NOT_EQUAL,
70+
CompareOperator.NOT_EQUAL,
7171
new ColumnValue(5));
7272
otsClient.PutRow(request);
7373

@@ -82,7 +82,7 @@ public static void ConditionPutRow()
8282
{
8383
// 新增条件:col0列的值等于5
8484
request.Condition.ColumnCondition = new RelationalCondition("col0",
85-
RelationalCondition.CompareOperator.EQUAL,
85+
CompareOperator.EQUAL,
8686
new ColumnValue(5));
8787
otsClient.PutRow(request);
8888

@@ -137,11 +137,11 @@ public static void ConditionUpdateRow()
137137
{
138138
// 构造condition
139139
var cond1 = new RelationalCondition("col0",
140-
RelationalCondition.CompareOperator.NOT_EQUAL,
140+
CompareOperator.NOT_EQUAL,
141141
new ColumnValue(5));
142-
var cond2 = new RelationalCondition("col1", RelationalCondition.CompareOperator.EQUAL,
142+
var cond2 = new RelationalCondition("col1", CompareOperator.EQUAL,
143143
new ColumnValue("a"));
144-
var columenCondition = new CompositeCondition(CompositeCondition.LogicOperator.AND);
144+
var columenCondition = new CompositeCondition(LogicOperator.AND);
145145
columenCondition.AddCondition(cond1);
146146
columenCondition.AddCondition(cond2);
147147

@@ -203,7 +203,7 @@ public static void ConditionDeleteRow()
203203
// 构造条件语句:col2列的值等于true
204204
var condition = new Condition(RowExistenceExpectation.EXPECT_EXIST);
205205
condition.ColumnCondition = new RelationalCondition("col2",
206-
RelationalCondition.CompareOperator.EQUAL,
206+
CompareOperator.EQUAL,
207207
new ColumnValue(true));
208208

209209
// 构造删除请求
@@ -260,15 +260,15 @@ public static void ConditionBatchWriteRow()
260260
// 构造条件语句:col0列的值不等于5
261261
var condition = new Condition(RowExistenceExpectation.IGNORE);
262262
condition.ColumnCondition = new RelationalCondition("col0",
263-
RelationalCondition.CompareOperator.NOT_EQUAL,
263+
CompareOperator.NOT_EQUAL,
264264
new ColumnValue(5));
265265

266266
// 构造col2列的值
267267
var attr1 = new AttributeColumns();
268268
attr1.Add("col2", new ColumnValue(false));
269269

270270
// 构造批量写请求
271-
var rowChange = new RowChanges();
271+
var rowChange = new RowChanges(tableName);
272272
rowChange.AddPut(condition, primaryKey, attr1);
273273

274274
var batchWriteRequest = new BatchWriteRowRequest();

sample/Samples/CreateTableSample.cs

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,19 @@ namespace Aliyun.OTS.Samples
99
public static class CreateTableSample
1010
{
1111

12-
private static string TableName = "createTableSample";
12+
private static readonly string TableName = "createTableSample";
1313

1414
public static void TableOperations()
1515
{
1616
// 创建表
1717
OTSClient otsClient = Config.GetClient();
1818
{
1919
Console.WriteLine("Start create table...");
20-
PrimaryKeySchema primaryKeySchema = new PrimaryKeySchema();
21-
primaryKeySchema.Add("pk0", ColumnValueType.Integer);
22-
primaryKeySchema.Add("pk1", ColumnValueType.String);
20+
PrimaryKeySchema primaryKeySchema = new PrimaryKeySchema
21+
{
22+
{ "pk0", ColumnValueType.Integer },
23+
{ "pk1", ColumnValueType.String }
24+
};
2325
TableMeta tableMeta = new TableMeta(TableName, primaryKeySchema);
2426

2527
CapacityUnit reservedThroughput = new CapacityUnit(1, 1);
@@ -56,12 +58,12 @@ public static void TableOperations()
5658
}
5759

5860
// 删除表
59-
//{
60-
//Console.WriteLine("Start delete table...");
61-
//DeleteTableRequest request = new DeleteTableRequest(TableName);
62-
//otsClient.DeleteTable(request);
63-
//Console.WriteLine("Table is deleted.");
64-
//}
61+
{
62+
Console.WriteLine("Start delete table...");
63+
DeleteTableRequest request = new DeleteTableRequest(TableName);
64+
otsClient.DeleteTable(request);
65+
Console.WriteLine("Table is deleted.");
66+
}
6567
}
6668
}
6769
}

0 commit comments

Comments
 (0)