Explorar o código

修改sqllite 的连接测试

devin.zhu@doverfs.com hai 1 ano
pai
achega
975cf627df

+ 1 - 1
src/XF.Common.Api/Pages/GasStation/Index.razor

@@ -253,7 +253,7 @@
         save_load = true;
         SetcheckBox(model);
         server.SaveSite(model);
-        server2.GetProcessMeteConfig();
+        var data=server2.GetProcessMeteConfig();
         save_load = false;
     }
 }

+ 8 - 2
src/XF.Common.Api/Server/Core/Model/FCC/Configuration/ProcessorMetaConfig.cs

@@ -1,5 +1,6 @@
 
 using Microsoft.EntityFrameworkCore.Internal;
+using SqlSugar;
 using System;
 using System.Collections.Generic;
 using System.ComponentModel.DataAnnotations;
@@ -10,9 +11,10 @@ using System.Text.Json;
 
 namespace XF.Common.Core.Model.FCC
 {
+    [SugarTable("ProcessorMetaConfigs")]
     public class ProcessorMetaConfigDbModel
     {
-        [Key]
+        [SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
         public int Id { get; set; }
 
         [Required]
@@ -20,18 +22,22 @@ namespace XF.Common.Core.Model.FCC
         public string Description { get; set; }
         public ProcessorTypeEnum Type { get; set; }
 
+        [SugarColumn(IsIgnore =true)]
         public IEnumerable<ProcessorMetaPartsMetaConfigDbModel> Parts { get; set; }
         public bool Activated { get; set; }
         public DateTime TimeStamp { get; set; }
     }
 
 
+    [SugarTable("ProcessorMetaPartsMetaConfigs")]
     public class ProcessorMetaPartsMetaConfigDbModel
     {
-        [Key]
+        [SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
         public int Id { get; set; }
 
         public int ProcessorMetaConfigId { get; set; }
+
+        [SugarColumn(IsIgnore = true)]
         public virtual ProcessorMetaConfigDbModel ProcessorMetaConfig { get; set; }
 
         public ProcessorMetaPartsTypeEnum Type { get; set; }

+ 1 - 0
src/XF.Common.Api/Server/Core/Repositories/IProcessorMetaConfigRepository.cs

@@ -8,5 +8,6 @@ namespace XF.Common.Server.Core.Repositories
     /// </summary>
     public interface IProcessorMetaConfigRepository:ILiteRepository<ProcessorMetaConfigDbModel>
     {
+        Task<object> GetData();
     }
 }

+ 1 - 1
src/XF.Common.Api/Server/Repositories/PgSql/Base/SqlSugarHelper.cs

@@ -55,7 +55,7 @@ namespace XF.Common.Repositories.Base
         public static SqlSugarScope Sqlite = new SqlSugarScope(new ConnectionConfig()
         {
             ConnectionString = ConnectionOption.FCCSqlite,
-            DbType = DbType.PostgreSQL,
+            DbType = DbType.Sqlite,
             InitKeyType = InitKeyType.Attribute,//从特性读取主键和自增列信息
             IsAutoCloseConnection = true,
             ConfigureExternalServices = new ConfigureExternalServices

+ 7 - 1
src/XF.Common.Api/Server/Repositories/SQLLite/FCCDB/ProcessorMetaConfigRepository.cs

@@ -12,9 +12,15 @@ namespace XF.Common.Server.Repositories.SQLLite.FCCDB
     /// <summary>
     /// bu info
     /// </summary>
-    [ServiceDescription(typeof(IBusiness_unit_infoReponse), ServiceLifetime.Scoped)]
+    [ServiceDescription(typeof(IProcessorMetaConfigRepository), ServiceLifetime.Scoped)]
     public class ProcessorMetaConfigRepository : LiteRepository<ProcessorMetaConfigDbModel>, IProcessorMetaConfigRepository
     {
+        public Task<object> GetData()
+        {
+            var connect=CurrentDb.Context.CurrentConnectionConfig;
+            return null;
+        }
+
         public async Task<object> GetObject()
         {
             return GetPageList<ProcessorMetaConfigDbModel>(c => true, new SqlSugar.PageModel()

+ 13 - 3
src/XF.Common.Api/Server/Services/FccConfigServer.cs

@@ -10,7 +10,7 @@ namespace XF.Common.Server.Services
     /// <summary>
     /// 
     /// </summary>
-    [ServiceDescription(typeof(ISiteServer), ServiceLifetime.Scoped)]
+    [ServiceDescription(typeof(IFccConfigServer), ServiceLifetime.Scoped)]
     public class FccConfigServer : IFccConfigServer
     {
         IProcessorMetaConfigRepository _metaConfigRepository;
@@ -20,8 +20,18 @@ namespace XF.Common.Server.Services
         }
         public async Task<object> GetProcessMeteConfig()
         {
-            var data = await _metaConfigRepository.GetListAsync();
-            return data;
+            try
+            {
+                
+                var data = await _metaConfigRepository.GetListAsync();
+                return data;
+            }
+            catch (Exception n)
+            {
+
+                throw;
+            }
+         
         }
     }
 }

+ 1 - 1
src/XF.Common.Api/appsettings.json

@@ -21,7 +21,7 @@
   "ConnectionStrings": {
     "Postgres": "Server=47.101.220.106;database=AccountingService_Sun_0230AMMon03180930AM;port=5432;User Id=postgres;Password=Postgres3141",
     "MysqlAccounting": "Server=47.101.220.106;user=root;database=AccountingService;port=3307;password=Wayne@123;SslMode=None",
-    "FCCSqlite": "Data Source=liteFccCore_sqlite_database.db;"
+    "FCCSqlite": "Data Source=liteFccCore_sqlite_database.db"          
   },
   "Login": {
     "User": "admin",

+ 0 - 0
src/XF.Common.Api/liteFccCore_sqlite_database.db