![]() |
VOOZH | about |
dotnet add package NetPro.Tdengine --version 6.0.16
NuGet\Install-Package NetPro.Tdengine -Version 6.0.16
<PackageReference Include="NetPro.Tdengine" Version="6.0.16" />
<PackageVersion Include="NetPro.Tdengine" Version="6.0.16" />Directory.Packages.props
<PackageReference Include="NetPro.Tdengine" />Project file
paket add NetPro.Tdengine --version 6.0.16
#r "nuget: NetPro.Tdengine, 6.0.16"
#:package NetPro.Tdengine@6.0.16
#addin nuget:?package=NetPro.Tdengine&version=6.0.16Install as a Cake Addin
#tool nuget:?package=NetPro.Tdengine&version=6.0.16Install as a Cake Tool
对涛思数据库连接对象Maikebing.Data.Taos的简易封装,使用单例TaosConnection对象
客户端驱动下载地址 客户端与服务器版本必须强一致;
即使使用ip连接,也必须配置fqdn:
taosd | grep -i fqdn
# local fully qualified domain name (FQDN)
fqdn h26.taosdata.com #taos数据库远程hostname,既fqdn
# first port number for the connection (12 continuous UDP/TCP port number are used)
serverPort 6030 #客户端连接端口,默认6030,udp
windows本地客户端测试
.\taos.exe -h h26.taosdata.com -P 6030
响应以下即成功,显示客户端版本为2.4.0.7,服务器必定也是2.4.0.7版本
Welcome to the TDengine shell from Windows, Client Version:2.4.0.7
Copyright (c) 2020 by TAOS Data, Inc. All rights reserved.
Tdengine时区 修改
修改C:\TDengine\cfg下的taos.cfg配置文件中的timezone节点与服务器保持一致; 特别注意Tdengine执行的时区标准为 unix的时间标准,与传统的东8 是+8不一样,在Tdengine需配置为UTC-8
# system time zone
timezone UTC+0 #0时区(伦敦时间)
#timezone UTC-8 #东八区(北京时间)
restful 方式访问Tdengine需注意
调用 rest/sql ,响应时间以服务器时区为准,并且格式为 2022-02-17 12:31:45.375
调用 rest/sqlt,响应时间为unix时间戳
"TdengineOption": {
"ConnectionString": [
{
"Key": "taos1", //连接串key别名,唯一
"Value": "Data Source=h26.taosdata.com;DataBase=db_20220120141621;Username=root;Password=taosdata;Port=6030" //别名key对应的连接串
}
]
},
没有基于NetPro.Web.Api 的使用场景,必须手动进行初始化,如下:
IConfiguration Configuration;
public void ConfigureServices(IServiceCollection services)
{
services.AddTdengine(Configuration);
}
基于NetPro.Web.Api的使用,只需要添加引用后配置以上appsetting.josn配置TaosOption节点即可
当想自定义连接字符串获取方式时,无论是否基于NetPro.Web.Api, 都能通过传入委托来自定义连接字符串获取方式:
public void ConfigureServices(IServiceCollection services)
{
services.AddTdengineDb(GetConnectionString);
}
public List<ConnectionString> GetConnectionString(IServiceProvider serviceProvider)
{
return new List<ConnectionString>
{
new ConnectionString()
{
Key ="remotekey",
Value = "Data Source=h26.taosdata.com;DataBase=db_netpro;Username=root;Password=taosdata;Port=6030"
}
};
}
public class TaosService: ITaosService
{
private readonly TdengineMulti _taosdbMulti;
public TaosService(TdengineMulti taosdbMulti)
{
_taosdbMulti = taosdbMulti;
}
/// <summary>
/// 执行Sql
/// </summary>
public void Executesql(string sql)
{
using var taos= _taosdbMulti.Get("taos1");
using var command= taos.CreateCommand(@"INSERT INTO data_history_67
USING datas TAGS (mongo, 67)
values ( 1608173534840 2 false 'Channel1.窑.烟囱温度' '烟囱温度' '122.00' );");
using var reader= command.ExecuteReader();//command和reader都必须using
}
}
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 net5.0 was computed. net5.0-windows net5.0-windows was computed. net6.0 net6.0 is compatible. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 was computed. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
| .NET Core | netcoreapp3.1 netcoreapp3.1 is compatible. |
This package is not used by any NuGet packages.
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 6.0.16 | 347 | 7/24/2023 |
| 6.0.15 | 614 | 7/19/2022 |
| 6.0.14 | 635 | 7/10/2022 |
| 6.0.13 | 585 | 6/15/2022 |
| 6.0.12 | 586 | 6/15/2022 |
| 6.0.11 | 582 | 6/15/2022 |
| 6.0.10 | 631 | 6/11/2022 |
| 6.0.9 | 612 | 6/8/2022 |
| 6.0.8 | 590 | 5/26/2022 |
| 6.0.8-beta.3 | 269 | 5/24/2022 |
| 6.0.8-beta.2 | 302 | 5/24/2022 |
| 6.0.7 | 599 | 5/18/2022 |
| 6.0.6 | 612 | 4/28/2022 |
| 6.0.5-beta.20 | 295 | 4/27/2022 |
| 6.0.5-beta.19 | 298 | 4/25/2022 |
| 6.0.5-beta.18 | 288 | 4/22/2022 |
| 6.0.5-beta.17 | 270 | 4/16/2022 |
| 6.0.5-beta.16 | 293 | 4/8/2022 |
| 6.0.5-beta.15 | 305 | 4/8/2022 |
| 6.0.5-beta.14 | 279 | 4/7/2022 |