Skip to content

Commit

Permalink
修改未.net 8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
maikebing committed Oct 22, 2024
1 parent c4918d3 commit 59a3069
Show file tree
Hide file tree
Showing 15 changed files with 66 additions and 46 deletions.
1 change: 1 addition & 0 deletions docker-compose.dcproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@
</None>
<None Include="docker-compose.yml" />
<None Include=".dockerignore" />
<None Include="taos.cfg" />
</ItemGroup>
</Project>
3 changes: 2 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ services:
- taos-network

taos:
image: tdengine/tdengine:3.2.1.0
image: tdengine/tdengine:3.3.3.0
restart: always
hostname: taos
volumes:
Expand All @@ -23,6 +23,7 @@ services:
- 6030:6030
- 6035:6035
- 6041:6041
- 6043:6043
- 6030-6040:6030-6040/udp
networks:
- taos-network
Expand Down
14 changes: 7 additions & 7 deletions src/EFCore.Taos.Core/IoTSharp.EntityFrameworkCore.Taos.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>

<Description>TaosData database provider for Entity Framework Core.</Description>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Authors>Maikebing</Authors>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
Expand All @@ -15,7 +15,7 @@
Maikebing.EntityFrameworkCore.Taos 是一个Entity Framework Core 的提供器, 基于Maikebing.Data.Taos构建。
</PackageReleaseNotes>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<Copyright>Copyright © 2019-2023 IoTSharp All rights reserved.</Copyright>
<Copyright>Copyright © 2019-2024 IoTSharp All rights reserved.</Copyright>
<Version>1.0.1</Version>
<PackageTags>Taos;Data;ADO.NET;Entity Framework;EF; Core;Data O/RM;entity-framework-core;TDengine</PackageTags>
<Platforms>AnyCPU;x64;x86</Platforms>
Expand All @@ -25,14 +25,14 @@
<Compile Include="..\Shared\*.cs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Abstractions" Version="7.0.10" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.10" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.10">
<PackageReference Include="Microsoft.EntityFrameworkCore.Abstractions" Version="8.0.10" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.10" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.10">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="7.0.10" />
<PackageReference Include="Microsoft.Extensions.DependencyModel" Version="7.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="8.0.10" />
<PackageReference Include="Microsoft.Extensions.DependencyModel" Version="8.0.2" />
</ItemGroup>
<ItemGroup>
<None Include="..\..\docs\logo.png">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// ReSharper disable once CheckNamespace
namespace Microsoft.EntityFrameworkCore.Metadata.Conventions
{
public class TaosAttributeConvention : EntityTypeAttributeConventionBase<TaosAttribute>
public class TaosAttributeConvention : Microsoft.EntityFrameworkCore.Metadata.Conventions.TypeAttributeConventionBase<TaosAttribute>
{
public TaosAttributeConvention(ProviderConventionSetBuilderDependencies dependencies) : base(dependencies)
{
Expand Down
4 changes: 2 additions & 2 deletions src/EFCore.Taos.Core/Migrations/TaosMigrationsSqlGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ protected override void Generate(


var table = model?.GetRelationalModel().FindTable(operation.Name, operation.Schema);
var mt = table.EntityTypeMappings.FirstOrDefault().EntityType.ClrType;
var mt = table.EntityTypeMappings.FirstOrDefault().TypeBase.ClrType;
var tabInfo = mt.GetCustomAttribute<TaosAttribute>();
var isSupertable = tabInfo?.IsSuperTable ?? false;
//IColumn column = table?.FindColumn(operation.Name);
Expand Down Expand Up @@ -404,7 +404,7 @@ private void CreateTableColumnsWithComments(
MigrationCommandListBuilder builder)
{
var table = model?.GetRelationalModel().FindTable(operation.Name, null);
var mt = table.EntityTypeMappings.FirstOrDefault().EntityType.ClrType;
var mt = table.EntityTypeMappings.FirstOrDefault().TypeBase.ClrType;
var propInfos = mt.GetProperties()
.Select(s => (propertyInfo: s, Info: s.GetCustomAttribute<TaosColumnAttribute>()))
.Where(w => w.Info != null)
Expand Down
5 changes: 2 additions & 3 deletions src/EFCore.Taos.Core/Query/Internal/TaosQuerySqlGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ protected override Expression VisitSqlConstant(SqlConstantExpression sqlConstant
{
return base.VisitSqlConstant(sqlConstantExpression);
}
protected override Expression VisitLike(LikeExpression likeExpression)
protected override void GenerateLike(LikeExpression likeExpression, bool negated)
{
Visit(likeExpression.Match);
this.Sql.Append(" LIKE ");
Expand All @@ -117,8 +117,7 @@ protected override Expression VisitLike(LikeExpression likeExpression)
this.Sql.Append(" ESCAPE ");
Visit(likeExpression.EscapeChar);
}

return likeExpression;
}

}
}
16 changes: 8 additions & 8 deletions src/EFCore.Taos.Core/Update/Internal/TaosUpdateSqlGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -213,20 +213,20 @@ protected void AppendInsertCommand(
{
var tableMap = command.Table.EntityTypeMappings.FirstOrDefault(f =>
{
var attr = f.EntityType.ClrType.GetCustomAttribute<TaosAttribute>();
var attr = f.TypeBase.ClrType.GetCustomAttribute<TaosAttribute>();
if (attr != null && !string.IsNullOrEmpty(attr.TableName))
{
return attr.TableName == command.TableName;
}
return f.EntityType.ClrType.Name == command.TableName;
return f.TypeBase. ClrType.Name == command.TableName;
});
var isSupperTable = false;
var subTableName = string.Empty;

var propertyAttrMaps = tableMap.EntityType.ClrType.GetProperties().Select(s => (PropertyInfo: s, Attr: s.GetCustomAttribute<TaosColumnAttribute>())).ToList();
var propertyAttrMaps = tableMap.TypeBase.ClrType.GetProperties().Select(s => (PropertyInfo: s, Attr: s.GetCustomAttribute<TaosColumnAttribute>())).ToList();
if (tableMap != null)
{
var taosAttr = tableMap.EntityType.ClrType.GetCustomAttribute<TaosAttribute>();
var taosAttr = tableMap.TypeBase.ClrType.GetCustomAttribute<TaosAttribute>();
if (taosAttr != null)
{
isSupperTable = taosAttr.IsSuperTable;
Expand Down Expand Up @@ -399,20 +399,20 @@ protected void AppendInsertCommandHeader(
{
var tableMap = command.Table.EntityTypeMappings.FirstOrDefault(f =>
{
var attr = f.EntityType.ClrType.GetCustomAttribute<TaosAttribute>();
var attr = f.TypeBase.ClrType.GetCustomAttribute<TaosAttribute>();
if (attr != null && !string.IsNullOrEmpty(attr.TableName))
{
return attr.TableName == command.TableName;
}
return f.EntityType.ClrType.Name == command.TableName;
return f.TypeBase.ClrType.Name == command.TableName;
});
var isSupperTable = false;
var subTableName = string.Empty;

var propertyAttrMaps = tableMap.EntityType.ClrType.GetProperties().Select(s => (PropertyInfo: s, Attr: s.GetCustomAttribute<TaosColumnAttribute>())).ToList();
var propertyAttrMaps = tableMap.TypeBase.ClrType.GetProperties().Select(s => (PropertyInfo: s, Attr: s.GetCustomAttribute<TaosColumnAttribute>())).ToList();
if (tableMap != null)
{
var taosAttr = tableMap.EntityType.ClrType.GetCustomAttribute<TaosAttribute>();
var taosAttr = tableMap.TypeBase.ClrType.GetCustomAttribute<TaosAttribute>();
if (taosAttr != null)
{
isSupperTable = taosAttr.IsSuperTable;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,36 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Carbunql" Version="0.8.13.1" />
<PackageReference Include="Alba" Version="8.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="8.0.10" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageReference Include="coverlet.collector" Version="6.0.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="MSTest.TestAdapter" Version="3.6.0" />
<PackageReference Include="MSTest.TestFramework" Version="3.6.0" />
<PackageReference Include="MXLogger" Version="2.0.8" />
<PackageReference Include="Testcontainers" Version="3.10.0" />
<PackageReference Include="Testcontainers.InfluxDb" Version="3.10.0" />
<PackageReference Include="Testcontainers.MongoDb" Version="3.10.0" />
<PackageReference Include="Testcontainers.MySql" Version="3.10.0" />
<PackageReference Include="Testcontainers.PostgreSql" Version="3.10.0" />
<PackageReference Include="Testcontainers.RabbitMq" Version="3.10.0" />
<PackageReference Include="Ductus.FluentDocker.MsTest" Version="2.10.59" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.11.0" />
<PackageReference Include="MSTest.TestAdapter" Version="2.2.7" />
<PackageReference Include="MSTest.TestFramework" Version="2.2.7" />
<PackageReference Include="MSTest.TestAdapter" Version="3.6.1" />
<PackageReference Include="MSTest.TestFramework" Version="3.6.1" />
<PackageReference Include="coverlet.collector" Version="3.2.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="SqModel" Version="0.8.15" />
</ItemGroup>

<ItemGroup>
Expand Down
12 changes: 6 additions & 6 deletions src/EntityFrameworkCore.Taos.Tests/SqModelTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ public void TestExecuteBulkInsert_Json()
var s2 = SelectQueryParser.Parse(SQLDemo2);
Assert.AreEqual(5, ((int?)s2.Parameters?.Count).GetValueOrDefault());

Assert.AreEqual("@p1", s2.Parameters?.Keys.ToArray()[0]);
Assert.AreEqual("@p1", s2.Parameters.FirstOrDefault()?.ParameterName);

var pn2 = s2.Parameters;
Assert.AreEqual(1, pn2.Count);
Assert.AreEqual("@p1", pn2.Keys.ToArray()[0]);
Assert.AreEqual("@p1", pn2.FirstOrDefault()?.ParameterName);
var s3 = SelectQueryParser.Parse(SQLDemo3);
Assert.AreEqual(7, s3.Parameters?.Count);
Assert.AreEqual("@t1", s3.Parameters?.ToArray()[1].Key);
Assert.AreEqual("@t11", s3.Parameters?.ToArray()[3].Key);
Assert.AreEqual("@t1", s3.Parameters[1].ParameterName);
Assert.AreEqual("@t11", s3.Parameters[3].ParameterName);
// Assert.AreEqual(" LIMIT ",s3.);
//Assert.AreEqual("@t3", s3[5].OriginalText);
//Assert.AreEqual(";", s3[6].OriginalText);
Expand All @@ -60,8 +60,8 @@ public void TestExecuteBulkInsert_Json()

var s5 = SelectQueryParser.Parse("insert into #subtable using stable tags($t1,$t2,$t3,$t4,$t5,$t6,$t7,$t8,$t9,$t10,$t11,$t12,$t13) values (@t1,@t2,@t3,@t4,@t5,@t6,@t7,@t8,@t9,@t10,@t11,@t12,@t13,@t14)");
Assert.AreEqual(14, s5.Parameters?.Count);
Assert.AreEqual("#subtable", s5.Parameters?.ToArray()[0].Key);
Assert.AreEqual(13, s5.Parameters?.Count(k=>k.Key.StartsWith('$')));
Assert.AreEqual("#subtable", s5.Parameters?.FirstOrDefault()?.ParameterName);
Assert.AreEqual(13, s5.Parameters.Count(k=>k.ParameterName.StartsWith('$')));
// Assert.AreEqual("insert into ? using stable tags(?,?,?,?,?,?,?,?,?,?,?,?,?) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?)", s4.CommandText);

}
Expand Down
2 changes: 1 addition & 1 deletion src/Example/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ RUN echo "deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main contrib
echo "deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-backports main contrib non-free" >> /etc/apt/sources.list && \
apt-get -y -q update && apt-get install -y --no-install-recommends -q apt-utils lsof net-tools wget curl iputils-ping inetutils-tools && \
apt-get autoremove -y && apt-get clean && apt-get autoclean && rm /var/cache/apt/* -rf && ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
RUN curl -o TDengine-client.tar.gz "https://www.taosdata.com/assets-download/3.0/TDengine-client-3.2.1.0-Linux-x64.tar.gz" && \
RUN curl -o TDengine-client.tar.gz "https://www.taosdata.com/assets-download/3.0/TDengine-client-3.3.3.0-Linux-x64.tar.gz" && \
tar -xvf TDengine-client.tar.gz && rm TDengine-client.tar.gz -f && cd $(ls TDengine-client* -d) && \
./install_client.sh && \
rm $(pwd) -rf
Expand Down
8 changes: 4 additions & 4 deletions src/Example/Example.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<Authors>Maikebing</Authors>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<DockerfileContext>..\..</DockerfileContext>
</PropertyGroup>


<ItemGroup>
<PackageReference Include="ConsoleTableExt" Version="3.2.0" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.14.0" />
<PackageReference Include="System.Text.Encoding.CodePages" Version="6.0.0" />
<PackageReference Include="ConsoleTableExt" Version="3.3.0" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.21.0" />
<PackageReference Include="System.Text.Encoding.CodePages" Version="8.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
8 changes: 4 additions & 4 deletions src/Example/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ private static void Main(string[] args)
{
//issue259_258();
var IS_RUNNING_IN_CONTAINER = bool.TryParse(Environment.GetEnvironmentVariable("DOTNET_RUNNING_IN_CONTAINER"), out bool _DOTNET_RUNNING_IN_CONTAINER) && _DOTNET_RUNNING_IN_CONTAINER;
var _dbhost = "172.16.0.189";// IS_RUNNING_IN_CONTAINER ? "taos" : System.Net.Dns.GetHostName();
var _dbhost = IS_RUNNING_IN_CONTAINER ? "taos" : System.Net.Dns.GetHostName();
Console.WriteLine($"主机名:{_dbhost} 当前程序运行在{(IS_RUNNING_IN_CONTAINER ? "容器内" : "主机中")} ");
Console.WriteLine($"CPU:{Environment.ProcessorCount} 主机名:{Environment.MachineName}");
var p = new Ping();
Expand All @@ -60,13 +60,13 @@ private static void Main(string[] args)
DataSource = _dbhost,
DataBase = database,
Username = "root",
Password = "astop.123",
Password = "taosdata",
Port = 6030,
ConnectionTimeout = 10000,
PoolSize = 20000
PoolSize = 20
};
builder.ConnectionTimeout = 10000;
UseTaosEFCore(builder.UseRESTful());
UseTaosEFCore(builder.UseNative());

var builder_cloud = new TaosConnectionStringBuilder()
{
Expand Down
2 changes: 1 addition & 1 deletion src/IoTSharp.Data.Taos/IoTSharp.Data.Taos.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
IoTSharp.Data.Taos.TaosParameter
IoTSharp.Data.Taos.TaosTransaction
</Description>
<TargetFrameworks>net6;net7;net8;net4.6;netstandard2.0</TargetFrameworks>
<TargetFrameworks>net6;net8;net4.6;netstandard2.0</TargetFrameworks>
<LangVersion>10</LangVersion>
<PackageTags>Taos;Data;ADO.NET;Entity Framework,;EF; Core;Data O/RM,;entity-framework-core;TDengine;IoTSharp</PackageTags>
<Authors>Yanhong Ma</Authors>
Expand Down
7 changes: 5 additions & 2 deletions src/IoTSharp.Data.Taos/Protocols/TDRESTful/TaosRESTful.cs
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,11 @@ public TaosDataReader ExecuteReader(CommandBehavior behavior, TaosCommand comman

private TaosResult Execute(string _commandText)
{
var cmdPackage = CombineCommandPackage.CreatePackage(_commandText, this);
return cmdPackage.ExeTask.Result;

var cmdPackage = CombineCommandPackage.CreatePackage(_commandText, this);
Debug.Assert(_commandText != "create database if not exists ntest");
return cmdPackage.ExeTask.Result;

}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks" Version="8.0.10" />
<PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions" Version="8.0.10" />
</ItemGroup>

<ItemGroup>
Expand Down

0 comments on commit 59a3069

Please sign in to comment.