@@ -15,7 +15,7 @@ namespace HealthMonitor.Core.Context.Taos | |||
public class HealthMonitorTaosDataContext : DbContext, IWithDataSchema | |||
{ | |||
public DbSet<StbHmBloodPress> StbHmBloodPress { get; set; } = default!; | |||
public DbSet<HmBloodPress> HmBloodPress { get; set; } = default!; | |||
public string DataSchema { get; } | |||
public HealthMonitorTaosDataContext(DbContextOptions<HealthMonitorTaosDataContext> options) | |||
: base(options) | |||
@@ -25,78 +25,89 @@ namespace HealthMonitor.Core.Context.Taos | |||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) | |||
{ | |||
// base.OnConfiguring(optionsBuilder); | |||
optionsBuilder.UseTaos(@"Data Source=172.16.255.180;DataBase=health_monitor;Username=root;Password=taosdata;Port=6030;PoolSize=20;Protocol=Native"); | |||
base.OnConfiguring(optionsBuilder); | |||
//optionsBuilder.UseTaos(@"Data Source=172.16.255.180;DataBase=health_monitor;Username=root;Password=taosdata;Port=6030;PoolSize=20;Protocol=Native"); | |||
} | |||
protected override void OnModelCreating(ModelBuilder modelBuilder) | |||
{ | |||
//modelBuilder.HasDefaultSchema(DataSchema); | |||
// modelBuilder.HasDefaultSchema(DataSchema); | |||
//var typesToRegister = Assembly.GetExecutingAssembly().GetTypes() | |||
// .Where(type => !string.IsNullOrEmpty(type.Namespace) && type.Namespace.StartsWith("HealthMonitor.Core.Map.HealthMonitor.Taos")) | |||
// .Where(type => type.BaseType != null && type.BaseType.IsGenericType && type.BaseType.GetGenericTypeDefinition() == typeof(GenericEntityTypeConfiguration<>)); | |||
var typesToRegister1 = Assembly.GetExecutingAssembly().GetTypes() | |||
.Where(type => !string.IsNullOrEmpty(type.Namespace) | |||
&& type.Namespace.StartsWith("HealthMonitor.Core.Map.HealthMonitor.Taos")); | |||
//foreach (var t in typesToRegister) | |||
//{ | |||
// dynamic configurationInstance = Activator.CreateInstance(t)!; | |||
// modelBuilder.ApplyConfiguration(configurationInstance); | |||
//} | |||
var typesToRegister = Assembly.GetExecutingAssembly().GetTypes() | |||
.Where(type => !string.IsNullOrEmpty(type.Namespace) && type.Namespace.StartsWith("HealthMonitor.Core.Map.HealthMonitor.Taos")) | |||
.Where(type => type.BaseType != null && type.BaseType.IsGenericType && type.BaseType.GetGenericTypeDefinition() == typeof(GenericEntityTypeConfiguration<>)); | |||
//base.OnModelCreating(modelBuilder); | |||
foreach (var t in typesToRegister) | |||
{ | |||
dynamic configurationInstance = Activator.CreateInstance(t)!; | |||
modelBuilder.ApplyConfiguration(configurationInstance); | |||
} | |||
base.OnModelCreating(modelBuilder); | |||
modelBuilder.Entity<StbHmBloodPress>().HasKey(e => e.Ts) | |||
.HasName("PRIMARY"); | |||
//var a1 = typesToRegister1; | |||
//var a2 = typesToRegister; | |||
modelBuilder.Entity<StbHmBloodPress>().ToTable("stb_hm_bloodpress"); | |||
//modelBuilder.Entity<HmBloodPress>().HasKey(e => e.Ts) | |||
// .HasName("PRIMARY"); | |||
modelBuilder.Entity<StbHmBloodPress>().Property(e => e.Ts) | |||
.HasColumnName("ts") | |||
.HasColumnType("timestamp"); | |||
//modelBuilder.Entity<HmBloodPress>().ToTable("stb_hm_bloodpress"); | |||
modelBuilder.Entity<StbHmBloodPress>() | |||
.Property(e => e.Serialno) | |||
.HasColumnName("serialno"); | |||
//modelBuilder.Entity<HmBloodPress>().Property(e => e.Ts) | |||
// .HasColumnName("ts") | |||
// .HasColumnType("timestamp"); | |||
modelBuilder.Entity<StbHmBloodPress>() | |||
.Property(e => e.BloodPressId) | |||
.HasColumnName("bloodpress_id"); | |||
//modelBuilder.Entity<HmBloodPress>() | |||
// .Property(e => e.Serialno) | |||
// .HasColumnName("serialno"); | |||
modelBuilder.Entity<StbHmBloodPress>() | |||
.Property(e => e.MessageId) | |||
.HasColumnName("message_id"); | |||
//modelBuilder.Entity<HmBloodPress>() | |||
// .Property(e => e.BloodPressId) | |||
// .HasColumnName("bloodpress_id"); | |||
modelBuilder.Entity<StbHmBloodPress>() | |||
.Property(e => e.SystolicValue) | |||
.HasColumnName("systolic_value"); | |||
//modelBuilder.Entity<HmBloodPress>() | |||
// .Property(e => e.MessageId) | |||
// .HasColumnName("message_id"); | |||
modelBuilder.Entity<StbHmBloodPress>() | |||
.Property(e => e.DiastolicValue) | |||
.HasColumnName("diastolic_value"); | |||
//modelBuilder.Entity<HmBloodPress>() | |||
// .Property(e => e.SystolicValue) | |||
// .HasColumnName("systolic_value"); | |||
//modelBuilder.Entity<HmBloodPress>() | |||
// .Property(e => e.DiastolicValue) | |||
// .HasColumnName("diastolic_value"); | |||
modelBuilder.Entity<StbHmBloodPress>() | |||
.Property(e => e.LastUpdate) | |||
.HasColumnName("last_update"); | |||
//modelBuilder.Entity<HmBloodPress>() | |||
// .Property(e => e.LastUpdate) | |||
// .HasColumnName("last_update"); | |||
modelBuilder.Entity<StbHmBloodPress>() | |||
.Property(e => e.CreateTime) | |||
.HasColumnName("create_time"); | |||
//modelBuilder.Entity<HmBloodPress>() | |||
// .Property(e => e.CreateTime) | |||
// .HasColumnName("create_time"); | |||
//modelBuilder.Entity<HmBloodPress>() | |||
// .Property(e => e.Method) | |||
// .HasColumnName("method"); | |||
//modelBuilder.Entity<HmBloodPress>() | |||
// .Property(e => e.IsDisplay) | |||
// .HasColumnName("is_display"); | |||
//modelBuilder.Entity<HmBloodPress>() | |||
// .Property(e => e.TailNo) | |||
// .HasColumnName("serial_tail_no"); | |||
modelBuilder.Entity<StbHmBloodPress>() | |||
.Property(e => e.Method) | |||
.HasColumnName("method"); | |||
modelBuilder.Entity<StbHmBloodPress>() | |||
.Property(e => e.IsDisplay) | |||
.HasColumnName("is_display"); | |||
modelBuilder.Entity<StbHmBloodPress>() | |||
.Property(e => e.TailNo) | |||
.HasColumnName("serial_tail_no"); | |||
} | |||
} | |||
} |
@@ -4,10 +4,11 @@ using System.Data; | |||
using System.Data.Common; | |||
using System.Linq.Expressions; | |||
using HealthMonitor.Core.Common; | |||
using HealthMonitor.Core.Dal.Taos; | |||
namespace HealthMonitor.Core.Dal.EfCoreImpl | |||
{ | |||
public class EfCoreDataAccessor : IGpsCardDataAccessor,IHealthMonitorDataAccessor | |||
public class EfCoreDataAccessor : IGpsCardDataAccessor,IHealthMonitorDataAccessor, IHealthMonitorTaosDataAccessor | |||
{ | |||
private DbContext? _context; | |||
@@ -1,50 +1,50 @@ | |||
using Microsoft.EntityFrameworkCore; | |||
using Microsoft.Extensions.Configuration; | |||
using Microsoft.Extensions.Logging; | |||
using HealthMonitor.Core.Context; | |||
using HealthMonitor.Core.DbLog; | |||
using HealthMonitor.Core.Dal.EfCoreImpl; | |||
//using Microsoft.EntityFrameworkCore; | |||
//using Microsoft.Extensions.Configuration; | |||
//using Microsoft.Extensions.Logging; | |||
//using HealthMonitor.Core.Context; | |||
//using HealthMonitor.Core.DbLog; | |||
//using HealthMonitor.Core.Dal.EfCoreImpl; | |||
namespace HealthMonitor.Core.Dal.Factory | |||
{ | |||
/// <summary> | |||
/// 瞬态GpsCardContext构建帮助类 | |||
/// </summary> | |||
public class GpsCardAccessorFactory | |||
{ | |||
private readonly IConfiguration _configuration; | |||
private readonly ILogger<GpsCardAccessorFactory> _logger; | |||
private readonly ILoggerFactory _loggerFactory; | |||
//namespace HealthMonitor.Core.Dal.Factory | |||
//{ | |||
// /// <summary> | |||
// /// 瞬态GpsCardContext构建帮助类 | |||
// /// </summary> | |||
// public class GpsCardAccessorFactory | |||
// { | |||
// private readonly IConfiguration _configuration; | |||
// private readonly ILogger<GpsCardAccessorFactory> _logger; | |||
// private readonly ILoggerFactory _loggerFactory; | |||
public GpsCardAccessorFactory(IConfiguration configuration, ILogger<GpsCardAccessorFactory> logger, IEfCoreLoggerProvider loggerProvider) | |||
{ | |||
_configuration = configuration; | |||
_logger = logger; | |||
_loggerFactory = new LoggerFactory(new[] { loggerProvider }); | |||
} | |||
// public GpsCardAccessorFactory(IConfiguration configuration, ILogger<GpsCardAccessorFactory> logger, IEfCoreLoggerProvider loggerProvider) | |||
// { | |||
// _configuration = configuration; | |||
// _logger = logger; | |||
// _loggerFactory = new LoggerFactory(new[] { loggerProvider }); | |||
// } | |||
public virtual IGpsCardDataAccessor GetDbContext() | |||
{ | |||
var mySqlCon = _configuration.GetConnectionString("GpsCard_Connection_String"); | |||
var serverVersion = ServerVersion.AutoDetect(mySqlCon); | |||
var options = new DbContextOptionsBuilder<GpsCardContext>() | |||
.UseMySql(mySqlCon,serverVersion) | |||
.UseLoggerFactory(_loggerFactory) | |||
.Options; | |||
// public virtual IGpsCardDataAccessor GetDbContext() | |||
// { | |||
// var mySqlCon = _configuration.GetConnectionString("GpsCard_Connection_String"); | |||
// var serverVersion = ServerVersion.AutoDetect(mySqlCon); | |||
// var options = new DbContextOptionsBuilder<GpsCardContext>() | |||
// .UseMySql(mySqlCon,serverVersion) | |||
// .UseLoggerFactory(_loggerFactory) | |||
// .Options; | |||
var context = new GpsCardContext(options); | |||
return new EfCoreDataAccessor(context); | |||
// var context = new GpsCardContext(options); | |||
// return new EfCoreDataAccessor(context); | |||
////AOP需要依赖DI | |||
//var services = new ServiceCollection(); | |||
//services.AddTransient<IGpsCardDataAccessor, EfCoreDataAccessor>(sp => | |||
//{ | |||
// var context = new GpsCardContext(options); | |||
// return new EfCoreDataAccessor(context); | |||
//}); | |||
// ////AOP需要依赖DI | |||
// //var services = new ServiceCollection(); | |||
// //services.AddTransient<IGpsCardDataAccessor, EfCoreDataAccessor>(sp => | |||
// //{ | |||
// // var context = new GpsCardContext(options); | |||
// // return new EfCoreDataAccessor(context); | |||
// //}); | |||
//var provider = services.BuildDynamicProxyProvider(); | |||
//return provider.GetRequiredService<IGpsCardDataAccessor>(); | |||
} | |||
} | |||
} | |||
// //var provider = services.BuildDynamicProxyProvider(); | |||
// //return provider.GetRequiredService<IGpsCardDataAccessor>(); | |||
// } | |||
// } | |||
//} |
@@ -1,55 +1,55 @@ | |||
using Microsoft.EntityFrameworkCore; | |||
using Microsoft.Extensions.Configuration; | |||
using Microsoft.Extensions.Logging; | |||
using HealthMonitor.Core.Context; | |||
using HealthMonitor.Core.DbLog; | |||
using HealthMonitor.Core.Dal.EfCoreImpl; | |||
//using Microsoft.EntityFrameworkCore; | |||
//using Microsoft.Extensions.Configuration; | |||
//using Microsoft.Extensions.Logging; | |||
//using HealthMonitor.Core.Context; | |||
//using HealthMonitor.Core.DbLog; | |||
//using HealthMonitor.Core.Dal.EfCoreImpl; | |||
namespace HealthMonitor.Core.Dal.Factory | |||
{ | |||
/// <summary> | |||
/// 瞬态HealthMonitorContext构建帮助类 | |||
/// </summary> | |||
public class HealthMonitorAccessorFactory | |||
{ | |||
private readonly IConfiguration _configuration; | |||
private readonly ILogger<HealthMonitorAccessorFactory> _logger; | |||
private readonly ILoggerFactory _loggerFactory; | |||
//namespace HealthMonitor.Core.Dal.Factory | |||
//{ | |||
// /// <summary> | |||
// /// 瞬态HealthMonitorContext构建帮助类 | |||
// /// </summary> | |||
// public class HealthMonitorAccessorFactory | |||
// { | |||
// private readonly IConfiguration _configuration; | |||
// private readonly ILogger<HealthMonitorAccessorFactory> _logger; | |||
// private readonly ILoggerFactory _loggerFactory; | |||
public HealthMonitorAccessorFactory(IConfiguration configuration, ILogger<HealthMonitorAccessorFactory> logger, IEfCoreLoggerProvider loggerProvider) | |||
{ | |||
_configuration = configuration; | |||
_logger = logger; | |||
_loggerFactory = new LoggerFactory(new[] { loggerProvider }); | |||
} | |||
// public HealthMonitorAccessorFactory(IConfiguration configuration, ILogger<HealthMonitorAccessorFactory> logger, IEfCoreLoggerProvider loggerProvider) | |||
// { | |||
// _configuration = configuration; | |||
// _logger = logger; | |||
// _loggerFactory = new LoggerFactory(new[] { loggerProvider }); | |||
// } | |||
public virtual IHealthMonitorDataAccessor GetDbContext() | |||
{ | |||
//var options = new DbContextOptionsBuilder<HealthMonitorContext>() | |||
// .UseMySql(_configuration.GetConnectionString("HealthMonitor_Connection_String")) | |||
// .UseLoggerFactory(_loggerFactory) | |||
// .Options; | |||
// public virtual IHealthMonitorDataAccessor GetDbContext() | |||
// { | |||
// //var options = new DbContextOptionsBuilder<HealthMonitorContext>() | |||
// // .UseMySql(_configuration.GetConnectionString("HealthMonitor_Connection_String")) | |||
// // .UseLoggerFactory(_loggerFactory) | |||
// // .Options; | |||
var mySqlCon = _configuration.GetConnectionString("HealthMonitor_Connection_String"); | |||
var serverVersion = ServerVersion.AutoDetect(mySqlCon); | |||
var options = new DbContextOptionsBuilder<HealthMonitorContext>() | |||
.UseMySql(mySqlCon, serverVersion) | |||
.UseLoggerFactory(_loggerFactory) | |||
.Options; | |||
// var mySqlCon = _configuration.GetConnectionString("HealthMonitor_Connection_String"); | |||
// var serverVersion = ServerVersion.AutoDetect(mySqlCon); | |||
// var options = new DbContextOptionsBuilder<HealthMonitorContext>() | |||
// .UseMySql(mySqlCon, serverVersion) | |||
// .UseLoggerFactory(_loggerFactory) | |||
// .Options; | |||
var context = new HealthMonitorContext(options); | |||
return new EfCoreDataAccessor(context); | |||
// var context = new HealthMonitorContext(options); | |||
// return new EfCoreDataAccessor(context); | |||
////AOP需要依赖DI | |||
//var services = new ServiceCollection(); | |||
//services.AddTransient<IGpsCardDataAccessor, EfCoreDataAccessor>(sp => | |||
//{ | |||
// var context = new GpsCardContext(options); | |||
// return new EfCoreDataAccessor(context); | |||
//}); | |||
// ////AOP需要依赖DI | |||
// //var services = new ServiceCollection(); | |||
// //services.AddTransient<IGpsCardDataAccessor, EfCoreDataAccessor>(sp => | |||
// //{ | |||
// // var context = new GpsCardContext(options); | |||
// // return new EfCoreDataAccessor(context); | |||
// //}); | |||
//var provider = services.BuildDynamicProxyProvider(); | |||
//return provider.GetRequiredService<IGpsCardDataAccessor>(); | |||
} | |||
} | |||
} | |||
// //var provider = services.BuildDynamicProxyProvider(); | |||
// //return provider.GetRequiredService<IGpsCardDataAccessor>(); | |||
// } | |||
// } | |||
//} |
@@ -1,48 +1,48 @@ | |||
using Microsoft.EntityFrameworkCore; | |||
using Microsoft.Extensions.Configuration; | |||
using Microsoft.Extensions.Logging; | |||
using HealthMonitor.Core.Context; | |||
using HealthMonitor.Core.DbLog; | |||
using HealthMonitor.Core.Dal.EfCoreImpl; | |||
//using Microsoft.EntityFrameworkCore; | |||
//using Microsoft.Extensions.Configuration; | |||
//using Microsoft.Extensions.Logging; | |||
//using HealthMonitor.Core.Context; | |||
//using HealthMonitor.Core.DbLog; | |||
//using HealthMonitor.Core.Dal.EfCoreImpl; | |||
namespace HealthMonitor.Core.Dal.Factory | |||
{ | |||
/// <summary> | |||
/// 瞬态HealthMonitorContext构建帮助类 | |||
/// </summary> | |||
public class HealthMonitorTDengineAccessorFactory | |||
{ | |||
private readonly IConfiguration _configuration; | |||
private readonly ILogger<HealthMonitorTDengineAccessorFactory> _logger; | |||
private readonly ILoggerFactory _loggerFactory; | |||
//namespace HealthMonitor.Core.Dal.Factory | |||
//{ | |||
// /// <summary> | |||
// /// 瞬态HealthMonitorContext构建帮助类 | |||
// /// </summary> | |||
// public class HealthMonitorTDengineAccessorFactory | |||
// { | |||
// private readonly IConfiguration _configuration; | |||
// private readonly ILogger<HealthMonitorTDengineAccessorFactory> _logger; | |||
// private readonly ILoggerFactory _loggerFactory; | |||
public HealthMonitorTDengineAccessorFactory(IConfiguration configuration, ILogger<HealthMonitorTDengineAccessorFactory> logger, IEfCoreLoggerProvider loggerProvider) | |||
{ | |||
_configuration = configuration; | |||
_logger = logger; | |||
_loggerFactory = new LoggerFactory(new[] { loggerProvider }); | |||
} | |||
// public HealthMonitorTDengineAccessorFactory(IConfiguration configuration, ILogger<HealthMonitorTDengineAccessorFactory> logger, IEfCoreLoggerProvider loggerProvider) | |||
// { | |||
// _configuration = configuration; | |||
// _logger = logger; | |||
// _loggerFactory = new LoggerFactory(new[] { loggerProvider }); | |||
// } | |||
//public virtual IHealthMonitorDataAccessor GetDbContext() | |||
//{ | |||
// //var options = new DbContextOptionsBuilder<HealthMonitorContext>() | |||
// // .UseMySql(_configuration.GetConnectionString("HealthMonitor_Connection_String")) | |||
// // .UseLoggerFactory(_loggerFactory) | |||
// // .Options; | |||
// //public virtual IHealthMonitorDataAccessor GetDbContext() | |||
// //{ | |||
// // //var options = new DbContextOptionsBuilder<HealthMonitorContext>() | |||
// // // .UseMySql(_configuration.GetConnectionString("HealthMonitor_Connection_String")) | |||
// // // .UseLoggerFactory(_loggerFactory) | |||
// // // .Options; | |||
// //var context = new HealthMonitorContext(options); | |||
// //return new EfCoreDataAccessor(context); | |||
// // //var context = new HealthMonitorContext(options); | |||
// // //return new EfCoreDataAccessor(context); | |||
// ////AOP需要依赖DI | |||
// //var services = new ServiceCollection(); | |||
// //services.AddTransient<IGpsCardDataAccessor, EfCoreDataAccessor>(sp => | |||
// //{ | |||
// // var context = new GpsCardContext(options); | |||
// // return new EfCoreDataAccessor(context); | |||
// //}); | |||
// // ////AOP需要依赖DI | |||
// // //var services = new ServiceCollection(); | |||
// // //services.AddTransient<IGpsCardDataAccessor, EfCoreDataAccessor>(sp => | |||
// // //{ | |||
// // // var context = new GpsCardContext(options); | |||
// // // return new EfCoreDataAccessor(context); | |||
// // //}); | |||
// //var provider = services.BuildDynamicProxyProvider(); | |||
// //return provider.GetRequiredService<IGpsCardDataAccessor>(); | |||
//} | |||
} | |||
} | |||
// // //var provider = services.BuildDynamicProxyProvider(); | |||
// // //return provider.GetRequiredService<IGpsCardDataAccessor>(); | |||
// //} | |||
// } | |||
//} |
@@ -0,0 +1,13 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace HealthMonitor.Core.Dal.Taos | |||
{ | |||
public interface IHealthMonitorTaosDataAccessor : IDataAccessor | |||
{ | |||
} | |||
} |
@@ -15,7 +15,6 @@ | |||
</ItemGroup> | |||
<ItemGroup> | |||
<Folder Include="Map\HealthMonitor\Taos\" /> | |||
<Folder Include="Operator\Default\" /> | |||
</ItemGroup> | |||
@@ -0,0 +1,141 @@ | |||
using HealthMonitor.Util.Entities.HealthMonitor; | |||
using HealthMonitor.Util.Entities.HealthMonitor.Taos; | |||
using Microsoft.EntityFrameworkCore; | |||
using Microsoft.EntityFrameworkCore.Metadata.Builders; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace HealthMonitor.Core.Map.HealthMonitor.Taos | |||
{ | |||
public class HmBloodPressMap : GenericEntityTypeConfiguration<HmBloodPress> | |||
{ | |||
//public override void Configure(EntityTypeBuilder<HmBloodPress> entity) | |||
//{ | |||
// entity.HasKey(e => e.Ts) | |||
// .HasName("PRIMARY"); | |||
// entity.ToTable("stb_hm_bloodpress"); | |||
// entity.Property(e => e.Ts) | |||
// .HasColumnName("ts") | |||
// .HasColumnType("timestamp"); | |||
// entity | |||
// .Property(e => e.Serialno) | |||
// .HasColumnName("serialno"); | |||
// entity | |||
// .Property(e => e.BloodPressId) | |||
// .HasColumnName("bloodpress_id") | |||
// entity | |||
// .Property(e => e.MessageId) | |||
// .HasColumnName("message_id"); | |||
// entity | |||
// .Property(e => e.SystolicValue) | |||
// .HasColumnName("systolic_value"); | |||
// entity | |||
// .Property(e => e.DiastolicValue) | |||
// .HasColumnName("diastolic_value"); | |||
// entity | |||
// .Property(e => e.LastUpdate) | |||
// .HasColumnName("last_update"); | |||
// entity | |||
// .Property(e => e.CreateTime) | |||
// .HasColumnName("create_time"); | |||
// entity | |||
// .Property(e => e.Method) | |||
// .HasColumnName("method"); | |||
// entity | |||
// .Property(e => e.IsDisplay) | |||
// .HasColumnName("is_display"); | |||
// entity | |||
// .Property(e => e.TailNo) | |||
// .HasColumnName("serial_tail_no"); | |||
//} | |||
public override void Configure(EntityTypeBuilder<HmBloodPress> entity) | |||
{ | |||
entity.HasKey(e => e.Ts) | |||
.HasName("PRIMARY"); | |||
entity.ToTable("stb_hm_bloodpress"); | |||
entity.Property(e => e.Ts) | |||
.HasColumnName("ts") | |||
.HasColumnType("timestamp"); | |||
entity | |||
.Property(e => e.Serialno) | |||
.HasColumnName("serialno") | |||
.HasDefaultValueSql("''"); | |||
entity | |||
.Property(e => e.BloodPressId) | |||
.HasColumnName("bloodpress_id") | |||
.HasDefaultValueSql("''"); | |||
entity | |||
.Property(e => e.MessageId) | |||
.HasColumnName("message_id").HasColumnType("VARCHAR").HasDefaultValueSql("''"); | |||
entity | |||
.Property(e => e.SystolicValue) | |||
.HasColumnName("systolic_value"); | |||
entity | |||
.Property(e => e.DiastolicValue) | |||
.HasColumnName("diastolic_value"); | |||
entity | |||
.Property(e => e.LastUpdate) | |||
.HasColumnName("last_update"); | |||
entity | |||
.Property(e => e.CreateTime) | |||
.HasColumnName("create_time"); | |||
entity | |||
.Property(e => e.Method) | |||
.HasColumnName("method"); | |||
entity | |||
.Property(e => e.IsDisplay) | |||
.HasColumnName("is_display"); | |||
entity | |||
.Property(e => e.TailNo) | |||
.HasColumnName("serial_tail_no"); | |||
} | |||
} | |||
} |
@@ -0,0 +1,185 @@ | |||
using HealthMonitor.Util.Entities.HealthMonitor.Taos; | |||
using IoTSharp.Data.Taos; | |||
using Microsoft.EntityFrameworkCore; | |||
using Microsoft.EntityFrameworkCore.Metadata.Builders; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace HealthMonitor.Core.Map.HealthMonitor.Taos | |||
{ | |||
public class HmBloodPressStatsIncMap : GenericEntityTypeConfiguration<HmBloodPressStatsInc> | |||
{ | |||
public override void Configure(EntityTypeBuilder<HmBloodPressStatsInc> entity) | |||
{ | |||
entity.HasKey(e => e.Ts) | |||
.HasName("PRIMARY"); | |||
entity.ToTable("stb_hm_bloodpress_stats_inc"); | |||
entity.Property(e => e.Ts) | |||
.HasColumnName("ts") | |||
.HasColumnType("timestamp"); | |||
entity | |||
.Property(e => e.Serialno) | |||
.HasColumnName("serialno") | |||
.HasColumnType("NCHAR"); | |||
//.HasConversion(typeof(string)) | |||
//.HasCharSet("utf8"); | |||
//.HasCollation("utf8_general_ci"); | |||
entity | |||
.Property(e => e.BloodPressId) | |||
.HasColumnName("bloodpress_id") | |||
.HasColumnType("NCHAR"); | |||
//.HasConversion(typeof(string)) | |||
//.HasCharSet("utf8"); | |||
entity | |||
.Property(e => e.MessageId) | |||
.HasColumnName("message_id") | |||
.HasColumnType("NCHAR"); | |||
//.HasConversion(typeof(string)) | |||
//.HasCharSet("utf8"); | |||
entity | |||
.Property(e => e.SystolicValue) | |||
.HasColumnName("systolic_value") | |||
.HasColumnType("INT"); | |||
entity | |||
.Property(e => e.SystolicRefValue) | |||
.HasColumnName("systolic_ref_value") | |||
.HasColumnType("INT"); | |||
entity | |||
.Property(e => e.SystolicAvgValue) | |||
.HasColumnName("systolic_avg_value") | |||
.HasColumnType("FLOAT"); | |||
entity | |||
.Property(e => e.SystolicMaxValue) | |||
.HasColumnName("systolic_max_value") | |||
.HasColumnType("INT"); | |||
entity | |||
.Property(e => e.SystolicMinValue) | |||
.HasColumnName("systolic_min_value") | |||
.HasColumnType("INT"); | |||
entity | |||
.Property(e => e.SystolicAvgOffset) | |||
.HasColumnName("systolic_avg_offset") | |||
.HasColumnType("FLOAT"); | |||
entity | |||
.Property(e => e.SystolicIncValue) | |||
.HasColumnName("systolic_inc_value") | |||
.HasColumnType("INT"); | |||
entity | |||
.Property(e => e.DiastolicValue) | |||
.HasColumnName("diastolic_value") | |||
.HasColumnType("INT"); | |||
entity | |||
.Property(e => e.DiastolicRefValue) | |||
.HasColumnName("diastolic_ref_value") | |||
.HasColumnType("INT"); | |||
entity | |||
.Property(e => e.DiastolicAvgValue) | |||
.HasColumnName("diastolic_avg_value") | |||
.HasColumnType("FLOAT"); | |||
entity | |||
.Property(e => e.DiastolicMaxValue) | |||
.HasColumnName("diastolic_max_value") | |||
.HasColumnType("INT"); | |||
entity | |||
.Property(e => e.DiastolicMinValue) | |||
.HasColumnName("diastolic_min_value") | |||
.HasColumnType("INT"); | |||
entity | |||
.Property(e => e.DiastolicAvgOffset) | |||
.HasColumnName("diastolic_avg_offset") | |||
.HasColumnType("FLOAT"); | |||
entity | |||
.Property(e => e.DiastolicIncValue) | |||
.HasColumnName("diastolic_inc_value") | |||
.HasColumnType("INT"); | |||
entity | |||
.Property(e => e.Gender) | |||
.HasColumnName("gender") | |||
.HasColumnType("TINYINT"); | |||
entity | |||
.Property(e => e.Age) | |||
.HasColumnName("age") | |||
.HasColumnType("INT"); | |||
//entity | |||
// .Property(e => e.Hypertension) | |||
// .HasColumnName("hypertension"); | |||
entity | |||
.Property(e => e.Height) | |||
.HasColumnName("height") | |||
.HasColumnType("FLOAT"); | |||
entity | |||
.Property(e => e.Weight) | |||
.HasColumnName("weight") | |||
.HasColumnType("FLOAT"); | |||
entity | |||
.Property(e => e.LastUpdate) | |||
.HasColumnName("last_update") | |||
.HasColumnType("timestamp"); | |||
entity | |||
.Property(e => e.StatDuration) | |||
.HasColumnName("stat_duration") | |||
.HasColumnType("INT"); | |||
entity | |||
.Property(e => e.StatStartTime) | |||
.HasColumnName("stat_start_time") | |||
.HasColumnType("timestamp"); | |||
entity | |||
.Property(e => e.StatEndTime) | |||
.HasColumnName("stat_end_time") | |||
.HasColumnType("timestamp"); | |||
entity | |||
.Property(e => e.Remark) | |||
.HasColumnName("remark") | |||
.HasColumnType("NCHAR"); | |||
// .HasConversion(typeof(string)) | |||
// .HasCharSet("utf8"); | |||
entity | |||
.Property(e => e.TailNo) | |||
.HasColumnName("serial_tail_no") | |||
.HasColumnType("NCHAR"); | |||
// .HasConversion(typeof(string)) | |||
// .HasCharSet("utf8"); | |||
} | |||
} | |||
} |
@@ -0,0 +1,33 @@ | |||
using Newtonsoft.Json; | |||
using System.ComponentModel.DataAnnotations.Schema; | |||
namespace HealthMonitor.Util.Entities.HealthMonitor.Taos | |||
{ | |||
public class HmBloodPress | |||
{ | |||
[Column("ts")] | |||
public DateTime Ts { get; set; } = default!; | |||
//[JsonProperty("bloodpress_id")] | |||
[Column("bloodpress_id")] | |||
public string BloodPressId { get; set; } ="aaaaa"; | |||
[Column("message_id")] | |||
public string MessageId { get; set; } = default!; | |||
[Column("serialno")] | |||
public string Serialno { get; set; } = default!; | |||
[Column("systolic_value")] | |||
public int SystolicValue { get; set; } | |||
[Column("diastolic_value")] | |||
public int DiastolicValue { get; set; } | |||
[Column("last_update")] | |||
public DateTime LastUpdate { get; set; } | |||
[Column("create_time")] | |||
public DateTime CreateTime { get; set; } | |||
[Column("method")] | |||
public sbyte Method { get; set; } | |||
[Column("is_display")] | |||
public bool IsDisplay { get; set; } | |||
[Column("serial_tail_no")] | |||
public string TailNo { get; set; }=string.Empty; | |||
} | |||
} |
@@ -0,0 +1,101 @@ | |||
using Newtonsoft.Json; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.ComponentModel.DataAnnotations.Schema; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace HealthMonitor.Util.Entities.HealthMonitor.Taos | |||
{ | |||
public class HmBloodPressStatsInc | |||
{ | |||
[JsonProperty("ts")] | |||
public DateTime Ts { get; set; } = default!; | |||
[JsonProperty("bloodpress_id")] | |||
[Column(TypeName = "varchar(36)")] | |||
public string BloodPressId { get; set; } = string.Empty; | |||
[JsonProperty("message_id")] | |||
public string MessageId { get; set; } = default!; | |||
[JsonProperty("serialno")] | |||
public string Serialno { get; set; } = default!; | |||
[JsonProperty("systolic_value")] | |||
public int SystolicValue { get; set; } | |||
[JsonProperty("systolic_ref_value")] | |||
public int SystolicRefValue { get; set; } | |||
[JsonProperty("systolic_avg_value")] | |||
public float SystolicAvgValue { get; set; } | |||
[JsonProperty("systolic_max_value")] | |||
public int SystolicMaxValue { get; set; } | |||
[JsonProperty("systolic_min_value")] | |||
public int SystolicMinValue { get; set; } | |||
[JsonProperty("systolic_avg_offset")] | |||
public float SystolicAvgOffset { get; set; } | |||
[JsonProperty("systolic_inc_value")] | |||
public int SystolicIncValue { get; set; } | |||
[JsonProperty("diastolic_value")] | |||
public int DiastolicValue { get; set; } | |||
[JsonProperty("diastolic_ref_value")] | |||
public int DiastolicRefValue { get; set; } | |||
[JsonProperty("diastolic_avg_value")] | |||
public float DiastolicAvgValue { get; set; } | |||
[JsonProperty("diastolic_max_value")] | |||
public int DiastolicMaxValue { get; set; } | |||
[JsonProperty("diastolic_min_value")] | |||
public int DiastolicMinValue { get; set; } | |||
[JsonProperty("diastolic_avg_offset")] | |||
public float DiastolicAvgOffset { get; set; } | |||
[JsonProperty("diastolic_inc_value")] | |||
public int DiastolicIncValue { get; set; } | |||
[JsonProperty("gender")] | |||
public sbyte Gender { get; set; } | |||
[JsonProperty("age")] | |||
public int Age { get; set; } | |||
[JsonProperty("height")] | |||
public float Height { get; set; } | |||
[JsonProperty("weight")] | |||
public float Weight { get; set; } | |||
[JsonProperty("last_update")] | |||
public DateTime LastUpdate { get; set; } | |||
[JsonProperty("stat_duration")] | |||
public int StatDuration { get; set; } | |||
[JsonProperty("stat_start_time")] | |||
public DateTime StatStartTime { get; set; } | |||
[JsonProperty("stat_end_time")] | |||
public DateTime StatEndTime { get; set; } | |||
[JsonProperty("remark")] | |||
public string? Remark { get; set; } = string.Empty; | |||
//[JsonProperty("hypertension")] | |||
//public bool? Hypertension { get; set; } | |||
[JsonProperty("serial_tail_no")] | |||
public string? TailNo { get; set; } = string.Empty; | |||
} | |||
} |
@@ -1,36 +0,0 @@ | |||
using Newtonsoft.Json; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace HealthMonitor.Util.Entities.HealthMonitor.Taos | |||
{ | |||
public class StbHmBloodPress | |||
{ | |||
[JsonProperty("ts")] | |||
public DateTime Ts { get; set; } = default!; | |||
[JsonProperty("bloodpress_id")] | |||
public string BloodPressId { get; set; } = default!; | |||
[JsonProperty("message_id")] | |||
public string MessageId { get; set; } = default!; | |||
[JsonProperty("serialno")] | |||
public string Serialno { get; set; } = default!; | |||
[JsonProperty("systolic_value")] | |||
public int SystolicValue { get; set; } | |||
[JsonProperty("diastolic_value")] | |||
public int DiastolicValue { get; set; } | |||
[JsonProperty("last_update")] | |||
public DateTime LastUpdate { get; set; } | |||
[JsonProperty("create_time")] | |||
public DateTime CreateTime { get; set; } | |||
[JsonProperty("method")] | |||
public sbyte Method { get; set; } | |||
[JsonProperty("is_display")] | |||
public bool IsDisplay { get; set; } | |||
[JsonProperty("serial_tail_no")] | |||
public string TailNo { get; set; }=string.Empty; | |||
} | |||
} |
@@ -11,7 +11,7 @@ using System.Threading.Tasks; | |||
using HealthMonitor.Core.Aop; | |||
using HealthMonitor.Core.Cache; | |||
using HealthMonitor.Core.Dal; | |||
using HealthMonitor.Core.Dal.Factory; | |||
//using HealthMonitor.Core.Dal.Factory; | |||
using HealthMonitor.Core.Operator; | |||
using HealthMonitor.Core.Query; | |||
using HealthMonitor.Core.Query.Extensions; | |||
@@ -21,6 +21,7 @@ using HealthMonitor.Util.Entities.Base; | |||
using HealthMonitor.Util.Models; | |||
using HealthMonitor.Util.QueryObjects; | |||
using HealthMonitor.WebApi.Filters; | |||
using IoTSharp.Data.Taos; | |||
namespace HealthMonitor.WebApi.Controllers.Base | |||
{ | |||
@@ -147,7 +148,7 @@ namespace HealthMonitor.WebApi.Controllers.Base | |||
public virtual void Add([FromBody] T model, [FromHeader] string requestId) | |||
{ | |||
AssertModelStateIsValid(model); | |||
_dataAccessor.Add(model); | |||
_dataAccessor.Save(); | |||
} | |||
@@ -1,17 +1,22 @@ | |||
using HealthMonitor.Common; | |||
using HealthMonitor.Core.Context.Taos; | |||
using HealthMonitor.Core.Dal; | |||
using HealthMonitor.Core.Dal.Taos; | |||
using HealthMonitor.Model.Cache; | |||
using HealthMonitor.Service.Biz.db; | |||
using HealthMonitor.Service.Cache; | |||
using HealthMonitor.Util.Entities.HealthMonitor; | |||
using HealthMonitor.Util.Entities.HealthMonitor.Taos; | |||
using HealthMonitor.WebApi.Configs; | |||
using Microsoft.AspNetCore.Mvc; | |||
using Microsoft.AspNetCore.Mvc.RazorPages; | |||
using Microsoft.EntityFrameworkCore; | |||
using Newtonsoft.Json; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Data; | |||
using System.Linq; | |||
using System.Reflection; | |||
using System.Security.Cryptography; | |||
using System.Text; | |||
using System.Text.RegularExpressions; | |||
@@ -33,6 +38,7 @@ namespace HealthMonitor.WebApi.Controllers.HealthMonitor | |||
private readonly PersonCacheManager _personCacheMgr; | |||
private readonly BloodPressReferenceValueCacheManager _bpRefValCacheManager; | |||
protected readonly IHealthMonitorDataAccessor _dataAccessor; | |||
protected readonly IHealthMonitorTaosDataAccessor _dataTaosAccessor; | |||
private readonly HealthMonitorTaosDataContext _db; | |||
@@ -43,7 +49,8 @@ namespace HealthMonitor.WebApi.Controllers.HealthMonitor | |||
PersonCacheManager personCacheMgr, | |||
BloodPressReferenceValueCacheManager bpRefValCacheManager, | |||
IHealthMonitorDataAccessor dataAccessor, | |||
HealthMonitorTaosDataContext db | |||
HealthMonitorTaosDataContext db, | |||
IHealthMonitorTaosDataAccessor dataTaosAccessor | |||
) | |||
{ | |||
@@ -53,12 +60,128 @@ namespace HealthMonitor.WebApi.Controllers.HealthMonitor | |||
_dataAccessor = dataAccessor; | |||
_bpRefValCacheManager = bpRefValCacheManager; | |||
_db = db; | |||
_dataTaosAccessor = dataTaosAccessor; | |||
} | |||
[HttpGet] | |||
public async Task<IActionResult> GetAsync([FromHeader] string requestId) | |||
{ | |||
var aa = await _db.StbHmBloodPress.FirstOrDefaultAsync(); | |||
//var aa = await _db.StbHmBloodPress.FirstOrDefaultAsync();HmBloodPressStatsInc | |||
//var aa = await _dataTaosAccessor.GetFirstOrDefaultAsync<HmBloodPress>(i => i.BloodPressId != ""); | |||
//var sql = $"INSERT INTO health_monitor.hm_bp_stats_inc_{bp.Serialno.Substring(bp.Serialno.Length - 2)} USING health_monitor.stb_hm_bloodpress_stats_inc TAGS ('{bp.Serialno.Substring(bp.Serialno.Length - 2)}') VALUES(" + | |||
// $"'{bp.LastUpdate:yyyy-MM-dd HH:mm:ss.fff}'," + | |||
// $"'{bp.BloodPressId}'," + | |||
// $"'{bp.MessageId}'," + | |||
// $"'{bp.Serialno}'," + | |||
// $"{bp.SystolicValue}," + | |||
// $"{systolicRefValue}," + | |||
// $"{systolicAvg}," + | |||
// $"{systolicMax}," + | |||
// $"{systolicMin}," + | |||
// $"{systolicAvgOffset}," + | |||
// $"{systolicInc}," + | |||
// $"{bp.DiastolicValue}," + | |||
// $"{diastolicRefValue}," + | |||
// $"{diastolicAvg}," + | |||
// $"{diastolicMax}," + | |||
// $"{diastolicMin}," + | |||
// $"{diastolicAvgOffset}," + | |||
//$"{diastolicInc}," + | |||
// $"{gender}," + | |||
// $"{age}," + | |||
// $"{height}," + | |||
// $"{weight}," + | |||
// $"'{bp.LastUpdate:yyyy-MM-dd HH:mm:ss.fff}'," + | |||
// $"{duration}," + | |||
// $"'{startTime:yyyy-MM-dd HH:mm:ss.fff}'," + | |||
// $"'{endTime:yyyy-MM-dd HH:mm:ss.fff}'," + | |||
// $"'{string.Empty}')"; | |||
//var aab = await _dataTaosAccessor.GetFirstOrDefaultAsync<HmBloodPress>(i => i.BloodPressId != ""); | |||
var aa = "OK"; | |||
//_dataTaosAccessor.Add<HmBloodPressStatsInc>(new HmBloodPressStatsInc | |||
//{ | |||
// Ts = DateTime.Now, | |||
// BloodPressId = "12", | |||
// MessageId = "1111111111111111", | |||
// Serialno = "1111111111111111", | |||
// SystolicValue = 1, | |||
// SystolicRefValue = 1, | |||
// SystolicAvgValue = 1, | |||
// SystolicMaxValue = 1, | |||
// SystolicMinValue = 1, | |||
// SystolicAvgOffset = 1, | |||
// SystolicIncValue = 1, | |||
// DiastolicValue = 1, | |||
// DiastolicRefValue = 1, | |||
// DiastolicAvgValue = 1, | |||
// DiastolicMaxValue = 1, | |||
// DiastolicMinValue = 1, | |||
// DiastolicAvgOffset = 1, | |||
// DiastolicIncValue = 1, | |||
// Gender = 1, | |||
// Age = 1, | |||
// Height = 1, | |||
// Weight = 1, | |||
// LastUpdate = DateTime.Now, | |||
// StatDuration = 1, | |||
// StatStartTime = DateTime.Now, | |||
// StatEndTime = DateTime.Now, | |||
// Remark = "", | |||
// TailNo = "00" | |||
//}); | |||
try | |||
{ | |||
var model = | |||
new HmBloodPress | |||
{ | |||
TailNo = "27", | |||
BloodPressId = "111", | |||
CreateTime = DateTime.Now, | |||
DiastolicValue = 0, | |||
IsDisplay = false, | |||
LastUpdate = DateTime.Now, | |||
MessageId = "asdsdsd", | |||
Method = 1, | |||
Serialno = "00000", | |||
SystolicValue = 0, | |||
Ts = DateTime.Now, | |||
}; | |||
_dataTaosAccessor.Add | |||
( | |||
new HmBloodPress | |||
{ | |||
TailNo = "27", | |||
BloodPressId = "111", | |||
CreateTime = DateTime.Now, | |||
DiastolicValue = 0, | |||
IsDisplay = false, | |||
LastUpdate = DateTime.Now, | |||
MessageId = "asdsdsd", | |||
Method = 1, | |||
Serialno = "00000", | |||
SystolicValue = 0, | |||
Ts = DateTime.Now, | |||
} | |||
); | |||
//// var aaa= _dataTaosAccessor.GetAll<HmBloodPress>(); | |||
// _db.Database.EnsureCreated(); | |||
await _dataTaosAccessor.SaveAsync(); | |||
// _db.HmBloodPress.Add(model); | |||
//_db.SaveChanges(); | |||
} | |||
catch (Exception ex) | |||
{ | |||
Console.WriteLine(ex.Message + ex.StackTrace); | |||
} | |||
return Ok(aa); | |||
} | |||
@@ -5,7 +5,7 @@ using HealthMonitor.Core.Cache; | |||
using HealthMonitor.Core.Context; | |||
using HealthMonitor.Core.Dal.EfCoreImpl; | |||
using HealthMonitor.Core.Dal; | |||
using HealthMonitor.Core.Dal.Factory; | |||
//using HealthMonitor.Core.Dal.Factory; | |||
using HealthMonitor.Core.DbLog; | |||
using HealthMonitor.Core.Operator; | |||
using HealthMonitor.Core.Operator.Redis; | |||
@@ -32,6 +32,7 @@ using HealthMonitor.WebApi.HttpLog; | |||
using Microsoft.Extensions.Http; | |||
using Microsoft.Extensions.DependencyInjection.Extensions; | |||
using HealthMonitor.Core.Context.Taos; | |||
using HealthMonitor.Core.Dal.Taos; | |||
namespace HealthMonitor.WebApi | |||
{ | |||
@@ -91,7 +92,7 @@ namespace HealthMonitor.WebApi | |||
var serverVersion = ServerVersion.AutoDetect(mySqlCon); | |||
options.UseMySql(mySqlCon, serverVersion) | |||
.UseLoggerFactory(loggerFactory); | |||
}, poolSize: 64); ; | |||
}, poolSize: 64) ; | |||
builder.Services | |||
.AddScoped<IGpsCardDataAccessor, EfCoreDataAccessor>(sp => | |||
@@ -105,24 +106,26 @@ namespace HealthMonitor.WebApi | |||
return new EfCoreDataAccessor(context); | |||
}); | |||
#endregion | |||
//builder.Services.AddDbContextPool<HealthMonitorContext>((sp, options) => | |||
//{ | |||
// var loggerFactory = sp.GetRequiredService<EfCoreLoggerFactory>(); | |||
// options.UseMySql(builder.Configuration.GetConnectionString("GpsCard_Connection_String")) | |||
// .UseLoggerFactory(loggerFactory); | |||
//}, poolSize: 64); | |||
//builder.Services.AddScoped<IHealthMonitorDataAccessor, EfCoreDataAccessor>(sp => | |||
//{ | |||
// var context = sp.GetRequiredService<HealthMonitorContext>(); | |||
// return new EfCoreDataAccessor(context); | |||
//}); | |||
#region Taos TDengine 数据库 | |||
builder.Services // td healthmonitor | |||
.AddDbContextPool<HealthMonitorTaosDataContext>((sp, options) => | |||
{ | |||
var loggerFactory = sp.GetRequiredService<EfCoreLoggerFactory>(); | |||
var connStr = builder.Configuration.GetConnectionString("HealthMonitor_Taos_Connection_String"); | |||
options.UseTaos(connStr) | |||
.UseLoggerFactory(loggerFactory); | |||
}, poolSize: 64); | |||
builder.Services.AddScoped<IHealthMonitorTaosDataAccessor, EfCoreDataAccessor>(sp => | |||
{ | |||
var context = sp.GetRequiredService<HealthMonitorTaosDataContext>(); | |||
return new EfCoreDataAccessor(context); | |||
}); | |||
#endregion | |||
#region AOP | |||
//builder.Services.Configure<RedisConfig>(builder.Configuration.GetSection("Redis")); | |||
@@ -153,9 +156,9 @@ namespace HealthMonitor.WebApi | |||
//}); | |||
builder.Services | |||
.AddSingleton<GpsCardAccessorFactory>() | |||
.AddSingleton<HealthMonitorAccessorFactory>(); | |||
//builder.Services | |||
// .AddSingleton<GpsCardAccessorFactory>() | |||
// .AddSingleton<HealthMonitorAccessorFactory>(); | |||
//builder.Services.AddSingleton<HealthMonitorAccessorFactory>(); | |||
builder.Services | |||
@@ -193,7 +196,7 @@ namespace HealthMonitor.WebApi | |||
.AddSingleton<TDengineDataSubcribe>() | |||
.AddHostedService<Worker>(); | |||
#endregion | |||
builder.Services.AddDbContext<HealthMonitorTaosDataContext>(); | |||
builder.Host.UseSerilog(); | |||
@@ -28,9 +28,8 @@ | |||
"TelpoDataUrl": "https://id.ssjlai.com/data/" | |||
}, | |||
"ConnectionStrings": { | |||
//"GpsCard_Connection_String": "server=172.16.192.26;port=3304;database=user_operation_platform;uid=root;pwd=telpo#1234;CharSet=utf8;MinimumPoolSize=10;MaximumPoolSize=1000;SslMode=none", | |||
"GpsCard_Connection_String": "server=139.224.254.18;port=3305;database=gps_card;uid=root;pwd=telpo#1234;CharSet=utf8;MinimumPoolSize=10;MaximumPoolSize=1000;SslMode=none", | |||
"HealthMonitor_Connection_String": "server=139.224.254.18;port=3305;database=health_monitor;uid=root;pwd=telpo#1234;CharSet=utf8;MinimumPoolSize=10;MaximumPoolSize=1000;SslMode=none" | |||
"HealthMonitor_Connection_String": "server=139.224.254.18;port=3305;database=health_monitor;uid=root;pwd=telpo#1234;CharSet=utf8;MinimumPoolSize=10;MaximumPoolSize=1000;SslMode=none", | |||
"HealthMonitor_Taos_Connection_String": "Data Source=172.16.255.180;DataBase=health_monitor;Username=root;Password=taosdata;Port=6030;PoolSize=20;Protocol=Native" | |||
} | |||
} |
@@ -26,7 +26,7 @@ | |||
}, | |||
"ConnectionStrings": { | |||
"GpsCard_Connection_String": "server=rm-uf6j529mu0v6g0btp.mysql.rds.aliyuncs.com;port=3305;database=gps_card;uid=root;pwd=telpo#1234;CharSet=utf8;MinimumPoolSize=10;MaximumPoolSize=1000;SslMode=none", | |||
"HealthMonitor_Connection_String": "server=rm-uf6j529mu0v6g0btp.mysql.rds.aliyuncs.com;port=3305;database=health_monitor;uid=root;pwd=telpo#1234;CharSet=utf8;MinimumPoolSize=10;MaximumPoolSize=1000;SslMode=none" | |||
"HealthMonitor_Connection_String": "server=rm-uf6j529mu0v6g0btp.mysql.rds.aliyuncs.com;port=3305;database=health_monitor;uid=root;pwd=telpo#1234;CharSet=utf8;MinimumPoolSize=10;MaximumPoolSize=1000;SslMode=none", | |||
"HealthMonitor_Taos_Connection_String": "Data Source=172.19.42.48;DataBase=health_monitor;Username=root;Password=taosdata;Port=6030;PoolSize=20;Protocol=Native" | |||
} | |||
} |
@@ -34,10 +34,12 @@ | |||
}, | |||
"ConnectionStrings": { | |||
// 测试环境内网 | |||
"GpsCard_Connection_String": "server=172.19.42.40;port=3305;database=gps_card;uid=root;pwd=telpo#1234;CharSet=utf8;MinimumPoolSize=10;MaximumPoolSize=1000;SslMode=none", | |||
"HealthMonitor_Connection_String": "server=172.19.42.40;port=3305;database=health_monitor;uid=root;pwd=telpo#1234;CharSet=utf8;MinimumPoolSize=10;MaximumPoolSize=1000;SslMode=none" | |||
"GpsCard_Connection_String": "server=172.19.42.40;port=3305;database=gps_card;uid=root;pwd=telpo#1234;CharSet=utf8;MinimumPoolSize=10;MaximumPoolSize=1000;SslMode=none", | |||
"HealthMonitor_Connection_String": "server=172.19.42.40;port=3305;database=health_monitor;uid=root;pwd=telpo#1234;CharSet=utf8;MinimumPoolSize=10;MaximumPoolSize=1000;SslMode=none", | |||
"HealthMonitor_Taos_Connection_String": "Data Source=172.19.42.44;DataBase=health_monitor;Username=root;Password=taosdata;Port=6030;PoolSize=20;Protocol=Native" | |||
// 测试环境公网 | |||
//"GpsCard_Connection_String": "server=139.224.254.18;port=3305;database=gps_card;uid=root;pwd=telpo#1234;CharSet=utf8;MinimumPoolSize=10;MaximumPoolSize=1000;SslMode=none", | |||
// "HealthMonitor_Connection_String": "server=139.224.254.18;port=3305;database=health_monitor;uid=root;pwd=telpo#1234;CharSet=utf8;MinimumPoolSize=10;MaximumPoolSize=1000;SslMode=none" | |||
// "HealthMonitor_Connection_String": "server=139.224.254.18;port=3305;database=health_monitor;uid=root;pwd=telpo#1234;CharSet=utf8;MinimumPoolSize=10;MaximumPoolSize=1000;SslMode=none" | |||
} | |||
} |