NetPro.Tdengine 6.0.8-beta.2

This is a prerelease version of NetPro.Tdengine.
There is a newer version of this package available.
See the version list below for details.
dotnet add package NetPro.Tdengine --version 6.0.8-beta.2                
NuGet\Install-Package NetPro.Tdengine -Version 6.0.8-beta.2                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="NetPro.Tdengine" Version="6.0.8-beta.2" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add NetPro.Tdengine --version 6.0.8-beta.2                
#r "nuget: NetPro.Tdengine, 6.0.8-beta.2"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install NetPro.Tdengine as a Cake Addin
#addin nuget:?package=NetPro.Tdengine&version=6.0.8-beta.2&prerelease

// Install NetPro.Tdengine as a Cake Tool
#tool nuget:?package=NetPro.Tdengine&version=6.0.8-beta.2&prerelease                

NetPro.Tdengine使用

NuGet

涛思数据库连接对象Maikebing.Data.Taos的简易封装,使用单例TaosConnection对象

客户端驱动下载地址 客户端与服务器版本必须强一致;

即使使用ip连接,也必须配置fqdn:

  • 服务器执行以下命令获取服务器的fqdn值
taosd | grep -i fqdn
  • 修改hosts域名解析 添加服务器ip对应的fqdn值作为域名
  • 修改C:\TDengine\cfg 配置
# 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需注意

官方restful调用文档

调用 rest/sql ,响应时间以服务器时区为准,并且格式为 2022-02-17 12:31:45.375 调用 rest/sqlt,响应时间为unix时间戳

使用

appsetting.json
"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 Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp3.1 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
6.0.16 176 7/24/2023
6.0.15 407 7/19/2022
6.0.14 420 7/10/2022
6.0.13 404 6/15/2022
6.0.12 400 6/15/2022
6.0.11 401 6/15/2022
6.0.10 420 6/11/2022
6.0.9 429 6/8/2022
6.0.8 406 5/26/2022
6.0.8-beta.3 118 5/24/2022
6.0.8-beta.2 114 5/24/2022
6.0.7 414 5/18/2022
6.0.6 427 4/28/2022
6.0.5 443 3/30/2022
6.0.5-beta.20 116 4/27/2022
6.0.5-beta.19 120 4/25/2022
6.0.5-beta.18 118 4/22/2022
6.0.5-beta.17 117 4/16/2022
6.0.5-beta.16 114 4/8/2022
6.0.5-beta.15 124 4/8/2022
6.0.5-beta.14 129 4/7/2022
6.0.5-beta.13 124 4/7/2022
6.0.5-beta.12 122 4/6/2022
6.0.5-beta.11 124 4/6/2022
6.0.5-beta.10 129 3/31/2022
6.0.5-beta.9 131 3/26/2022
6.0.5-beta.8 126 3/22/2022
6.0.5-beta.7 121 3/21/2022
6.0.5-beta.6 125 3/14/2022
6.0.5-beta.5 125 3/2/2022
6.0.5-beta.4 121 2/22/2022
6.0.5-beta.3 120 2/18/2022
6.0.5-beta.2 117 2/18/2022
6.0.5-beta.1 130 2/16/2022