Robert 1 rok pred
rodič
commit
dc3b0e7899
61 zmenil súbory, kde vykonal 6499 pridanie a 1497 odobranie
  1. 3 3
      EVCB_OCPP.Domain/App.config
  2. 17 0
      EVCB_OCPP.Domain/ConnectionFactory/ISqlConnectionFactory.cs
  3. 50 0
      EVCB_OCPP.Domain/ConnectionFactory/SqlConnectionFactory.cs
  4. 41 38
      EVCB_OCPP.Domain/ConnectionLogDBContext.cs
  5. 5 4
      EVCB_OCPP.Domain/EVCB_OCPP.Domain.csproj
  6. 100 0
      EVCB_OCPP.Domain/Extensions/IServiceCollectionExtension.cs
  7. 413 57
      EVCB_OCPP.Domain/MainDBContext.cs
  8. 33 37
      EVCB_OCPP.Domain/MeterValueDBContext.cs
  9. 1074 0
      EVCB_OCPP.Domain/Migrations/20231019085717_InitialCreate.Designer.cs
  10. 438 0
      EVCB_OCPP.Domain/Migrations/20231019085717_InitialCreate.cs
  11. 1077 0
      EVCB_OCPP.Domain/Migrations/20231019090745_Updatetest.Designer.cs
  12. 28 0
      EVCB_OCPP.Domain/Migrations/20231019090745_Updatetest.cs
  13. 1074 0
      EVCB_OCPP.Domain/Migrations/20231019090908_RemoveUpdatetest.Designer.cs
  14. 28 0
      EVCB_OCPP.Domain/Migrations/20231019090908_RemoveUpdatetest.cs
  15. 75 0
      EVCB_OCPP.Domain/Migrations/ConnectionLogDB/20231019091533_InitialCreate.Designer.cs
  16. 42 0
      EVCB_OCPP.Domain/Migrations/ConnectionLogDB/20231019091533_InitialCreate.cs
  17. 72 0
      EVCB_OCPP.Domain/Migrations/ConnectionLogDB/ConnectionLogDBContextModelSnapshot.cs
  18. 1071 0
      EVCB_OCPP.Domain/Migrations/MainDBContextModelSnapshot.cs
  19. 74 0
      EVCB_OCPP.Domain/Migrations/MeterValueDB/20231019091245_InitialCreate.Designer.cs
  20. 43 0
      EVCB_OCPP.Domain/Migrations/MeterValueDB/20231019091245_InitialCreate.cs
  21. 71 0
      EVCB_OCPP.Domain/Migrations/MeterValueDB/MeterValueDBContextModelSnapshot.cs
  22. 25 0
      EVCB_OCPP.Domain/Models/ConnectionLogDB/MachineConnectionLog.cs
  23. 0 121
      EVCB_OCPP.Domain/Models/Database/ApiLogEntry.cs
  24. 0 54
      EVCB_OCPP.Domain/Models/Database/ConnectorMeterValueRecord.cs
  25. 0 64
      EVCB_OCPP.Domain/Models/Database/ConnectorStatus.cs
  26. 0 132
      EVCB_OCPP.Domain/Models/Database/Customer.cs
  27. 0 222
      EVCB_OCPP.Domain/Models/Database/Machine.cs
  28. 0 45
      EVCB_OCPP.Domain/Models/Database/MachineConfiguration.cs
  29. 0 70
      EVCB_OCPP.Domain/Models/Database/MachineConnectionLog.cs
  30. 0 70
      EVCB_OCPP.Domain/Models/Database/MachineError.cs
  31. 0 100
      EVCB_OCPP.Domain/Models/Database/MachineOperateRecord.cs
  32. 0 39
      EVCB_OCPP.Domain/Models/Database/MachineVersionFile.cs
  33. 0 28
      EVCB_OCPP.Domain/Models/Database/OCMF.cs
  34. 0 75
      EVCB_OCPP.Domain/Models/Database/ServerMessage.cs
  35. 0 52
      EVCB_OCPP.Domain/Models/Database/TransactionDataRecord.cs
  36. 0 181
      EVCB_OCPP.Domain/Models/Database/TransactionRecord.cs
  37. 0 101
      EVCB_OCPP.Domain/Models/Database/UploadFile.cs
  38. 31 0
      EVCB_OCPP.Domain/Models/MainDb/ConnectorMeterValueRecord.cs
  39. 29 0
      EVCB_OCPP.Domain/Models/MainDb/ConnectorStatus.cs
  40. 57 0
      EVCB_OCPP.Domain/Models/MainDb/Customer.cs
  41. 19 0
      EVCB_OCPP.Domain/Models/MainDb/LoadingBalance.cs
  42. 73 0
      EVCB_OCPP.Domain/Models/MainDb/Machine.cs
  43. 19 0
      EVCB_OCPP.Domain/Models/MainDb/MachineConfiguration.cs
  44. 27 0
      EVCB_OCPP.Domain/Models/MainDb/MachineError.cs
  45. 31 0
      EVCB_OCPP.Domain/Models/MainDb/MachineOperateRecord.cs
  46. 19 0
      EVCB_OCPP.Domain/Models/MainDb/MachineVersionFile.cs
  47. 15 0
      EVCB_OCPP.Domain/Models/MainDb/MigrationHistory.cs
  48. 15 0
      EVCB_OCPP.Domain/Models/MainDb/Ocmf.cs
  49. 27 0
      EVCB_OCPP.Domain/Models/MainDb/ServerMessage.cs
  50. 65 0
      EVCB_OCPP.Domain/Models/MainDb/TransactionRecord.cs
  51. 37 0
      EVCB_OCPP.Domain/Models/MainDb/UploadFile.cs
  52. 29 0
      EVCB_OCPP.Domain/Models/MainDb/VConnectorStatus.cs
  53. 23 0
      EVCB_OCPP.Domain/Models/MainDb/VConnectorStatusCombind.cs
  54. 35 0
      EVCB_OCPP.Domain/Models/MainDb/VMachine.cs
  55. 37 0
      EVCB_OCPP.Domain/Models/MainDb/VMachineCombind.cs
  56. 31 0
      EVCB_OCPP.Domain/Models/MeterValueDb/ConnectorMeterValueRecord.cs
  57. 1 1
      EVCB_OCPP.Domain/Properties/AssemblyInfo.cs
  58. 1 1
      EVCB_OCPP.MailService/Properties/AssemblyInfo.cs
  59. 1 1
      EVCB_OCPP.Packet/Properties/AssemblyInfo.cs
  60. 1 1
      EVCB_OCPP.Packet20/Properties/AssemblyInfo.cs
  61. 22 0
      migration_commands.txt

+ 3 - 3
EVCB_OCPP.Domain/App.config

@@ -15,9 +15,9 @@
     </providers>
   </entityFramework>
   <connectionStrings>
-    <add name="ConnectionLogDBContext" connectionString="data source=172.1.2.187;initial catalog=StandardOCPP_ConnectionLog;persist security info=True;user id=sa;password=Ph0930118811;MultipleActiveResultSets=True;App=EntityFramework" providerName="System.Data.SqlClient" />
-    <add name="MainDBContext" connectionString="data source=172.1.2.187;initial catalog=StandardOCPP_Main;;persist security info=True;user id=sa;password=Ph0930118811;MultipleActiveResultSets=True;App=EntityFramework" providerName="System.Data.SqlClient" />
-    <add name="MeterValueDBContext" connectionString="data source=172.1.2.187;initial catalog=StandardOCPP_MeterValue;;persist security info=True;user id=sa;password=Ph0930118811;MultipleActiveResultSets=True;App=EntityFramework" providerName="System.Data.SqlClient" />
+    <add name="ConnectionLogDBContext" connectionString="data source=zerova-ev-dev.database.windows.net;initial catalog=StandardOCPP_ConnectionLog;persist security info=True;user id=azdevsoftware;password=azdevsoftware;MultipleActiveResultSets=True;App=EntityFramework" providerName="System.Data.SqlClient" />
+    <add name="MainDBContext" connectionString="data source=zerova-ev-dev.database.windows.net;initial catalog=StandardOCPP_Main;;persist security info=True;user id=azdevsoftware;password=azdevsoftware;MultipleActiveResultSets=True;App=EntityFramework" providerName="System.Data.SqlClient" />
+    <add name="MeterValueDBContext" connectionString="data source=zerova-ev-dev.database.windows.net;initial catalog=StandardOCPP_MeterValue;;persist security info=True;user id=azdevsoftware;password=azdevsoftware;MultipleActiveResultSets=True;App=EntityFramework" providerName="System.Data.SqlClient" />
    
 </connectionStrings>
 </configuration>

+ 17 - 0
EVCB_OCPP.Domain/ConnectionFactory/ISqlConnectionFactory.cs

@@ -0,0 +1,17 @@
+using Microsoft.Data.SqlClient;
+using Microsoft.EntityFrameworkCore;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace EVCB_OCPP.Domain.ConnectionFactory;
+
+public interface ISqlConnectionFactory<T> where T : DbContext
+{
+    string ConnectionString { get; init; }
+    SqlConnection Create();
+    Task<SqlConnection> CreateAsync();
+}

+ 50 - 0
EVCB_OCPP.Domain/ConnectionFactory/SqlConnectionFactory.cs

@@ -0,0 +1,50 @@
+using Microsoft.EntityFrameworkCore;
+using Microsoft.Extensions.Logging;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Diagnostics;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Microsoft.Data.SqlClient;
+
+namespace EVCB_OCPP.Domain.ConnectionFactory;
+
+public class SqlConnectionFactory<T> : ISqlConnectionFactory<T> where T : DbContext
+{
+    private readonly ILogger<SqlConnectionFactory<T>> logger;
+
+    public string ConnectionString { get; init; }
+    public SqlConnectionFactory(ILogger<SqlConnectionFactory<T>> logger)
+    {
+        this.logger = logger;
+    }
+
+    public SqlConnection Create()
+    {
+        var sqlConnection = new SqlConnection(ConnectionString);
+        sqlConnection.Open();
+        return sqlConnection;
+    }
+
+    public async Task<SqlConnection> CreateAsync()
+    {
+        var timer = Stopwatch.StartNew();
+        long t0, t1;
+
+        var sqlConnection = new SqlConnection(ConnectionString);
+        t0 = timer.ElapsedMilliseconds;
+
+        await sqlConnection.OpenAsync();
+        t1 = timer.ElapsedMilliseconds;
+        timer.Stop();
+
+        if (t1 > 500)
+        {
+            logger.LogWarning("{type} SqlConnection Open slow {create}/{open}", typeof(T), t0, t1);
+        }
+
+        return sqlConnection;
+    }
+}

+ 41 - 38
EVCB_OCPP.Domain/ConnectionLogDBContext.cs

@@ -1,48 +1,51 @@
-namespace EVCB_OCPP.Domain
+using System;
+using System.Collections.Generic;
+using EVCB_OCPP.Domain.Models.ConnectionLogDB;
+using Microsoft.EntityFrameworkCore;
+
+namespace EVCB_OCPP.Domain;
+
+public partial class ConnectionLogDBContext : DbContext
 {
-    using EVCB_OCPP.Domain.Models.Database;
-    using Microsoft.EntityFrameworkCore;
-    using System;
-    using System.Linq;
+    public ConnectionLogDBContext()
+    {
+    }
 
-    public class ConnectionLogDBContext : DbContext
+    public ConnectionLogDBContext(DbContextOptions<ConnectionLogDBContext> options)
+        : base(options)
     {
-        // 您的內容已設定為使用應用程式組態檔 (App.config 或 Web.config)
-        // 中的 'ConnectionLogDBContext' 連接字串。根據預設,這個連接字串的目標是
-        // 您的 LocalDb 執行個體上的 'EVCB_OCPP.Domain.ConnectionLogDBContext' 資料庫。
-        // 
-        // 如果您的目標是其他資料庫和 (或) 提供者,請修改
-        // 應用程式組態檔中的 'ConnectionLogDBContext' 連接字串。
-        public ConnectionLogDBContext(): base()
-        {
-            //Database.SetInitializer<ConnectionLogDBContext>(null);
-            //this.Configuration.AutoDetectChangesEnabled = false;
-            //this.Configuration.ValidateOnSaveEnabled = false;
-            //this.Configuration.AutoDetectChangesEnabled = false;
-            //this.Configuration.LazyLoadingEnabled = false;
-            //this.Database.CommandTimeout = 180;
-        }
-
-        public ConnectionLogDBContext(DbContextOptions<ConnectionLogDBContext> options) : base(options)
-        {
+    }
 
-        }
+    public virtual DbSet<MachineConnectionLog> MachineConnectionLogs { get; set; }
 
-        // 針對您要包含在模型中的每種實體類型新增 DbSet。如需有關設定和使用
-        // Code First 模型的詳細資訊,請參閱 http://go.microsoft.com/fwlink/?LinkId=390109。
+//    protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
+//#warning To protect potentially sensitive information in your connection string, you should move it out of source code. You can avoid scaffolding the connection string by using the Name= syntax to read it from configuration - see https://go.microsoft.com/fwlink/?linkid=2131148. For more guidance on storing connection strings, see http://go.microsoft.com/fwlink/?LinkId=723263.
+//        => optionsBuilder.UseSqlServer("data source=zerova-ev-dev.database.windows.net;initial catalog=StandardOCPP_ConnectionLog;persist security info=True;user id=azdevsoftware;password=1h52dev#az;MultipleActiveResultSets=True;App=EntityFramework");
 
-        public virtual DbSet<MachineConnectionLog> MachineConnectionLog { get; set; }
+    protected override void OnModelCreating(ModelBuilder modelBuilder)
+    {
+        modelBuilder.UseCollation("Chinese_Taiwan_Stroke_CI_AS");
 
-        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
+        modelBuilder.Entity<MachineConnectionLog>(entity =>
         {
-            //optionsBuilder.UseSqlServer("data source=172.1.2.187;initial catalog=StandardOCPP_ConnectionLog;persist security info=True;user id=sa;password=Ph0930118811;MultipleActiveResultSets=True;App=EntityFramework");
-            base.OnConfiguring(optionsBuilder);
-        }
+            entity.HasKey(e => new { e.Id, e.CreatedOn });
+
+            entity.ToTable("MachineConnectionLog");
+
+            entity.Property(e => e.Id).ValueGeneratedOnAdd();
+            entity.Property(e => e.CreatedOn).HasColumnType("datetime");
+            entity.Property(e => e.ChargeBoxId).HasMaxLength(128);
+            entity.Property(e => e.Data).HasMaxLength(3600);
+            entity.Property(e => e.EvseendPoint)
+                .HasMaxLength(25)
+                .HasColumnName("EVSEEndPoint");
+            entity.Property(e => e.MessageType).HasMaxLength(50);
+            entity.Property(e => e.Msg).HasMaxLength(200);
+            entity.Property(e => e.Session).HasMaxLength(36);
+        });
+
+        OnModelCreatingPartial(modelBuilder);
     }
 
-    //public class MyEntity
-    //{
-    //    public int Id { get; set; }
-    //    public string Name { get; set; }
-    //}
-}
+    partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
+}

+ 5 - 4
EVCB_OCPP.Domain/EVCB_OCPP.Domain.csproj

@@ -12,7 +12,11 @@
   </PropertyGroup>
   <ItemGroup>
     <PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
-    <PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.0" />
+    <PackageReference Include="Microsoft.Data.SqlClient" Version="5.1.1" />
+    <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.12">
+      <PrivateAssets>all</PrivateAssets>
+      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
+    </PackageReference>
     <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.0" />
     <PackageReference Include="Microsoft.DotNet.UpgradeAssistant.Extensions.Default.Analyzers" Version="0.4.355802">
       <PrivateAssets>all</PrivateAssets>
@@ -23,9 +27,6 @@
     <Content Include="Doc\ReadMe.txt" />
     <Content Include="StoredProcedure\uspInsertMachineConnectionLog.sql" />
   </ItemGroup>
-  <ItemGroup>
-    <Compile Remove="Models\Database\TransactionDataRecord.cs" />
-  </ItemGroup>
   <PropertyGroup>
     <PreBuildEvent>GitVersion.exe $(ProjectDir) /updateassemblyinfo</PreBuildEvent>
   </PropertyGroup>

+ 100 - 0
EVCB_OCPP.Domain/Extensions/IServiceCollectionExtension.cs

@@ -0,0 +1,100 @@
+using EVCB_OCPP.Domain.ConnectionFactory;
+using Microsoft.Data.SqlClient;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.Extensions.Configuration;
+using Microsoft.Extensions.DependencyInjection;
+using Microsoft.Extensions.Logging;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace EVCB_OCPP.Domain.Extensions;
+
+public static class IServiceCollectionExtension
+{
+    public const string CommandTimeoutKey = "CommandTimeout";
+
+    public const string MainDbUserIdKey = "MainDbUserIdKey";
+    public const string MainDbPassKey = "MainDbPass";
+    public const string MainDbConnectionStringKey = "MainDBContext";
+
+    public const string MeterDbUserIdKey = "MeterValueDbUserId";
+    public const string MeterDbPassKey = "MeterValueDbPass";
+    public const string MeterDbConnectionStringKey = "MeterValueDBContext";
+
+    public const string ConnectionLogDbUserIdKey = "ConnectionLogDbUserId";
+    public const string ConnectionLogDbPassKey = "ConnectionLogDbPass";
+    public const string ConnectionLogDbConnectionStringKey = "ConnectionLogDBContext";
+
+    public static IServiceCollection AddMainDbContext(this IServiceCollection services, IConfiguration configuration)
+    {
+        var conneciotnString = configuration.GetConnectionString(MainDbUserIdKey, MainDbPassKey, MainDbConnectionStringKey);
+
+        services.AddSqlConnectionFactory<MainDBContext>(conneciotnString);
+        AddPortalDbContextInternal<MainDBContext>(services, configuration, conneciotnString, logToConsole: false);
+        return services;
+    }
+
+    public static IServiceCollection AddMeterValueDbContext(this IServiceCollection services, IConfiguration configuration)
+    {
+        var conneciotnString = configuration.GetConnectionString(MeterDbUserIdKey, MeterDbPassKey, MeterDbConnectionStringKey);
+        services.AddSqlConnectionFactory<MeterValueDBContext>(conneciotnString);
+        AddPortalDbContextInternal<MeterValueDBContext>(services, configuration, conneciotnString, logToConsole: false);
+        return services;
+    }
+
+    public static IServiceCollection AddConnectionLogDbContext(this IServiceCollection services, IConfiguration configuration)
+    {
+        var conneciotnString = configuration.GetConnectionString(ConnectionLogDbUserIdKey, ConnectionLogDbPassKey, ConnectionLogDbConnectionStringKey);
+        services.AddSqlConnectionFactory<ConnectionLogDBContext>(conneciotnString);
+        AddPortalDbContextInternal<ConnectionLogDBContext>(services, configuration, conneciotnString, logToConsole: false);
+        return services;
+    }
+
+    public static void AddSqlConnectionFactory<T>(this IServiceCollection services, string conneciotnString) where T : DbContext
+    {
+        services.AddSingleton<ISqlConnectionFactory<T>>(
+            (serviceProvider) =>
+            new SqlConnectionFactory<T>(serviceProvider.GetRequiredService<ILogger<SqlConnectionFactory<T>>>())
+            {
+                ConnectionString = conneciotnString
+            });
+    }
+
+    public static void AddPortalDbContextInternal<T>(
+        IServiceCollection services, IConfiguration configuration,
+        string connectionString, bool logToConsole = false) where T : DbContext
+    {
+
+        var commandTimeout = int.TryParse(configuration[CommandTimeoutKey], out var temp) ? temp : 180;
+
+        services.AddPooledDbContextFactory<T>((serviceProvider, options) => {
+            options.UseSqlServer(connectionString, dbOptions =>
+            {
+                dbOptions.CommandTimeout(commandTimeout);
+            });
+            options.UseLoggerFactory(serviceProvider.GetRequiredService<ILoggerFactory>());
+        });
+    }
+
+    public static string GetConnectionString(this IConfiguration configuration, string UserIdKey, string DbPassKey, string ConnectionStringKey)
+    {
+        string dbUserId = string.IsNullOrEmpty(configuration[UserIdKey]) ? string.Empty : $"user id={configuration[UserIdKey]};";
+        string dbUserPass = string.IsNullOrEmpty(configuration[DbPassKey]) ? string.Empty : $"password={configuration[DbPassKey]};";
+        string connectionString = configuration.GetConnectionString(ConnectionStringKey);
+
+        var builder = new SqlConnectionStringBuilder(connectionString);
+        if (!string.IsNullOrEmpty(dbUserId))
+        {
+            builder.UserID = dbUserId;
+        }
+        if (!string.IsNullOrEmpty(dbUserPass))
+        {
+            builder.Password = dbUserPass;
+        }
+
+        return builder.ToString();
+    }
+}

+ 413 - 57
EVCB_OCPP.Domain/MainDBContext.cs

@@ -1,89 +1,445 @@
-namespace EVCB_OCPP.Domain
+using System;
+using System.Collections.Generic;
+using EVCB_OCPP.Domain.Models.MainDb;
+using Microsoft.EntityFrameworkCore;
+
+namespace EVCB_OCPP.Domain;
+
+public partial class MainDBContext : DbContext
 {
-    using EVCB_OCPP.Domain.Models.Database;
-    using Microsoft.EntityFrameworkCore;
-    using System;
-    using System.Linq;
-    using System.Threading;
-    using System.Threading.Tasks;
-
-    public class MainDBContext : DbContext
+    public MainDBContext()
+    {
+    }
+
+    public MainDBContext(DbContextOptions<MainDBContext> options)
+        : base(options)
     {
-        // 您的內容已設定為使用應用程式組態檔 (App.config 或 Web.config)
-        // 中的 'MainDBContext' 連接字串。根據預設,這個連接字串的目標是
-        // 您的 LocalDb 執行個體上的 'EVCB_OCPP.Domain.MainDBContext' 資料庫。
-        // 
-        // 如果您的目標是其他資料庫和 (或) 提供者,請修改
-        // 應用程式組態檔中的 'MainDBContext' 連接字串。
-        public MainDBContext() : base()
+    }
+
+    public virtual DbSet<ConnectorMeterValueRecord> ConnectorMeterValueRecords { get; set; }
+
+    public virtual DbSet<ConnectorStatus> ConnectorStatuses { get; set; }
+
+    public virtual DbSet<Customer> Customers { get; set; }
+
+    public virtual DbSet<LoadingBalance> LoadingBalances { get; set; }
+
+    public virtual DbSet<Machine> Machines { get; set; }
+
+    public virtual DbSet<MachineConfiguration> MachineConfigurations { get; set; }
+
+    public virtual DbSet<MachineError> MachineErrors { get; set; }
+
+    public virtual DbSet<MachineOperateRecord> MachineOperateRecords { get; set; }
+
+    public virtual DbSet<MachineVersionFile> MachineVersionFiles { get; set; }
+
+    public virtual DbSet<MigrationHistory> MigrationHistories { get; set; }
+
+    public virtual DbSet<Ocmf> Ocmfs { get; set; }
+
+    public virtual DbSet<ServerMessage> ServerMessages { get; set; }
+
+    public virtual DbSet<TransactionRecord> TransactionRecords { get; set; }
+
+    public virtual DbSet<UploadFile> UploadFiles { get; set; }
+
+    public virtual DbSet<VConnectorStatus> VConnectorStatuses { get; set; }
+
+    public virtual DbSet<VConnectorStatusCombind> VConnectorStatusCombinds { get; set; }
+
+    public virtual DbSet<VMachine> VMachines { get; set; }
+
+    public virtual DbSet<VMachineCombind> VMachineCombinds { get; set; }
+
+//    protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
+//#warning To protect potentially sensitive information in your connection string, you should move it out of source code. You can avoid scaffolding the connection string by using the Name= syntax to read it from configuration - see https://go.microsoft.com/fwlink/?linkid=2131148. For more guidance on storing connection strings, see http://go.microsoft.com/fwlink/?LinkId=723263.
+//        => optionsBuilder.UseSqlServer("data source=zerova-ev-dev.database.windows.net;initial catalog=StandardOCPP_Main;persist security info=True;user id=azdevsoftware;password=1h52dev#az;MultipleActiveResultSets=True;App=EntityFramework");
+
+    protected override void OnModelCreating(ModelBuilder modelBuilder)
+    {
+        modelBuilder.UseCollation("Chinese_Taiwan_Stroke_CI_AS");
+
+        modelBuilder.Entity<ConnectorMeterValueRecord>(entity =>
+        {
+            entity.HasKey(e => e.Id).HasName("PK_dbo.ConnectorMeterValueRecord");
+
+            entity.ToTable("ConnectorMeterValueRecord");
+
+            entity.Property(e => e.ChargeBoxId).HasMaxLength(50);
+            entity.Property(e => e.CreatedOn).HasColumnType("datetime");
+            entity.Property(e => e.Value).HasMaxLength(10);
+        });
+
+        modelBuilder.Entity<ConnectorStatus>(entity =>
+        {
+            entity.HasKey(e => e.Id).HasName("PK_dbo.ConnectorStatus");
+
+            entity.ToTable("ConnectorStatus");
+
+            entity.HasIndex(e => new { e.ChargeBoxId, e.ConnectorId }, "IX_ConnectorStatus").IsUnique();
+
+            entity.Property(e => e.Id).HasMaxLength(36);
+            entity.Property(e => e.ChargeBoxId).HasMaxLength(50);
+            entity.Property(e => e.CreatedOn).HasColumnType("datetime");
+            entity.Property(e => e.ErrorInfo).HasMaxLength(50);
+            entity.Property(e => e.TotalEnergy).HasColumnType("decimal(10, 2)");
+            entity.Property(e => e.VendorErrorCode).HasMaxLength(100);
+            entity.Property(e => e.VendorId).HasMaxLength(255);
+        });
+
+        modelBuilder.Entity<Customer>(entity =>
         {
-            //this.Configuration.LazyLoadingEnabled = false;
-            //this.Database.CommandTimeout = 180;
-            //this.Database.AutoTransactionBehavior = AutoTransactionBehavior.Never;
-        }
+            entity.HasKey(e => e.Id).HasName("PK_dbo.Customer");
 
-        /// <summary>
-        /// DB coneection set
-        /// </summary>
-        //public MainDBContext(string conn)
-        //{
-        //    this.Database.Connection.ConnectionString = conn;
-        //    this.Configuration.LazyLoadingEnabled = false;
-        //    this.Database.CommandTimeout = 180;
-        //}
-        public MainDBContext(DbContextOptions<MainDBContext> options) : base(options)
+            entity.ToTable("Customer");
+
+            entity.Property(e => e.Id).ValueGeneratedNever();
+            entity.Property(e => e.ApiCustomerId).HasMaxLength(36);
+            entity.Property(e => e.ApiKey).HasMaxLength(128);
+            entity.Property(e => e.ApiKeyUpdatedOn).HasColumnType("datetime");
+            entity.Property(e => e.ApiUrl).HasMaxLength(256);
+            entity.Property(e => e.CreatedBy).HasMaxLength(50);
+            entity.Property(e => e.CreatedOn).HasColumnType("datetime");
+            entity.Property(e => e.Deadline).HasColumnType("datetime");
+            entity.Property(e => e.EnableTtia).HasColumnName("EnableTTIA");
+            entity.Property(e => e.Ftphost)
+                .HasMaxLength(50)
+                .HasColumnName("FTPHost");
+            entity.Property(e => e.Ftppassword)
+                .HasMaxLength(20)
+                .HasColumnName("FTPPassword");
+            entity.Property(e => e.Ftppath).HasColumnName("FTPPath");
+            entity.Property(e => e.Ftpuser)
+                .HasMaxLength(20)
+                .HasColumnName("FTPUser");
+            entity.Property(e => e.Name).HasMaxLength(50);
+            entity.Property(e => e.PartnerId).HasMaxLength(36);
+            entity.Property(e => e.TtiaApikey)
+                .HasMaxLength(10)
+                .HasColumnName("TTIA_APIKey");
+            entity.Property(e => e.TtiaApiurl)
+                .HasMaxLength(100)
+                .HasColumnName("TTIA_APIUrl");
+            entity.Property(e => e.TtiaCustomerId).HasColumnName("TTIA_CustomerId");
+            entity.Property(e => e.TtiaEquipmentProvider)
+                .HasMaxLength(10)
+                .HasColumnName("TTIA_EquipmentProvider");
+            entity.Property(e => e.UpdatedBy).HasMaxLength(50);
+            entity.Property(e => e.UpdatedOn).HasColumnType("datetime");
+        });
+
+        modelBuilder.Entity<LoadingBalance>(entity =>
+        {
+            entity.ToTable("LoadingBalance");
+
+            entity.Property(e => e.CreatedOn).HasColumnType("datetime");
+            entity.Property(e => e.FinishedOn).HasColumnType("datetime");
+            entity.Property(e => e.MachineId)
+                .IsRequired()
+                .HasMaxLength(36);
+            entity.Property(e => e.Power).HasColumnType("decimal(10, 2)");
+        });
+
+        modelBuilder.Entity<Machine>(entity =>
         {
-            //this.Database.AutoTransactionBehavior = AutoTransactionBehavior.Never;
-        }
+            entity.HasKey(e => e.Id).HasName("PK_dbo.Machine");
 
-        // 針對您要包含在模型中的每種實體類型新增 DbSet。如需有關設定和使用
-        // Code First 模型的詳細資訊,請參閱 http://go.microsoft.com/fwlink/?LinkId=390109。
+            entity.ToTable("Machine");
 
-        public virtual DbSet<OCMF> OCMF { get; set; }
+            entity.HasIndex(e => new { e.CustomerId, e.ChargeBoxId }, "nci_wi_Machine_7CD4A9D1688F96F6967B2244A0666F62");
 
-        public virtual DbSet<ConnectorStatus> ConnectorStatus { get; set; }
+            entity.Property(e => e.Id).HasMaxLength(36);
+            entity.Property(e => e.ChargeBoxId).HasMaxLength(50);
+            entity.Property(e => e.ChargeBoxSerialNumber).HasMaxLength(25);
+            entity.Property(e => e.ChargePointModel).HasMaxLength(20);
+            entity.Property(e => e.ChargePointSerialNumber).HasMaxLength(25);
+            entity.Property(e => e.ChargePointVendor).HasMaxLength(20);
+            entity.Property(e => e.Comment).HasMaxLength(100);
+            entity.Property(e => e.ConnectorPowerType).HasMaxLength(50);
+            entity.Property(e => e.ConnectorType).HasMaxLength(50);
+            entity.Property(e => e.CreatedBy).HasMaxLength(50);
+            entity.Property(e => e.CreatedOn).HasColumnType("datetime");
+            entity.Property(e => e.FwAssignedVersion).HasColumnName("FW_AssignedVersion");
+            entity.Property(e => e.FwCurrentVersion)
+                .HasMaxLength(50)
+                .HasColumnName("FW_CurrentVersion");
+            entity.Property(e => e.FwVersionReport).HasColumnName("FW_VersionReport");
+            entity.Property(e => e.HeartbeatUpdatedOn).HasColumnType("datetime");
+            entity.Property(e => e.Iccid).HasMaxLength(20);
+            entity.Property(e => e.Imsi).HasMaxLength(20);
+            entity.Property(e => e.Latitude).HasColumnType("decimal(10, 6)");
+            entity.Property(e => e.Longitude).HasColumnType("decimal(10, 6)");
+            entity.Property(e => e.MeterSerialNumber).HasMaxLength(25);
+            entity.Property(e => e.MeterType).HasMaxLength(25);
+            entity.Property(e => e.ModelName)
+                .IsRequired()
+                .HasMaxLength(50)
+                .HasDefaultValueSql("('')");
+            entity.Property(e => e.OfflineOn).HasColumnType("datetime");
+            entity.Property(e => e.RatedPower).HasColumnType("decimal(6, 2)");
+            entity.Property(e => e.Ttiatag).HasColumnName("TTIATag");
+            entity.Property(e => e.VendorId)
+                .HasMaxLength(50)
+                .HasDefaultValueSql("('Zerova')");
 
-        public virtual DbSet<Customer> Customer { get; set; }
+            entity.HasOne(d => d.Customer).WithMany(p => p.Machines)
+                .HasForeignKey(d => d.CustomerId)
+                .HasConstraintName("FK_dbo.Machine_dbo.Customer_CustomerId");
+        });
 
+        modelBuilder.Entity<MachineConfiguration>(entity =>
+        {
+            entity.HasKey(e => new { e.ConfigureName, e.ChargeBoxId }).HasName("PK_dbo.MachineConfigurations");
 
-        public virtual DbSet<Machine> Machine { get; set; }
+            entity.HasIndex(e => new { e.ConfigureName, e.ConfigureSetting }, "nci_wi_MachineConfigurations_132E765C043BF95A2570D2EA019DD783");
 
+            entity.Property(e => e.ConfigureName).HasMaxLength(50);
+            entity.Property(e => e.ChargeBoxId).HasMaxLength(50);
+            entity.Property(e => e.ConfigureSetting).HasMaxLength(500);
+            entity.Property(e => e.Id).ValueGeneratedOnAdd();
+        });
 
+        modelBuilder.Entity<MachineError>(entity =>
+        {
+            entity.HasKey(e => e.Id).HasName("PK_dbo.MachineError");
 
-        public virtual DbSet<MachineConfiguration> MachineConfigurations { get; set; }
+            entity.ToTable("MachineError");
 
-        public virtual DbSet<MachineError> MachineError { get; set; }
+            entity.Property(e => e.ChargeBoxId).HasMaxLength(50);
+            entity.Property(e => e.CreatedOn).HasColumnType("datetime");
+            entity.Property(e => e.ErrorInfo).HasMaxLength(50);
+            entity.Property(e => e.VendorErrorCode).HasMaxLength(100);
+            entity.Property(e => e.VendorId).HasMaxLength(255);
+        });
 
+        modelBuilder.Entity<MachineOperateRecord>(entity =>
+        {
+            entity.HasKey(e => e.Id).HasName("PK_dbo.MachineOperateRecord");
 
-        public virtual DbSet<MachineOperateRecord> MachineOperateRecord { get; set; }
+            entity.ToTable("MachineOperateRecord");
 
+            entity.Property(e => e.Action).HasMaxLength(30);
+            entity.Property(e => e.ChargeBoxId).HasMaxLength(50);
+            entity.Property(e => e.CreatedOn).HasColumnType("datetime");
+            entity.Property(e => e.EvseStatus).HasColumnName("EVSE_Status");
+            entity.Property(e => e.EvseValue).HasColumnName("EVSE_Value");
+            entity.Property(e => e.FinishedOn).HasColumnType("datetime");
+            entity.Property(e => e.ReportedOn).HasColumnType("datetime");
+            entity.Property(e => e.SerialNo).HasMaxLength(36);
+        });
 
+        modelBuilder.Entity<MachineVersionFile>(entity =>
+        {
+            entity.HasKey(e => e.Id).HasName("PK_dbo.MachineVersionFile");
 
-        public virtual DbSet<MachineVersionFile> MachineVersionFile { get; set; }
+            entity.ToTable("MachineVersionFile");
 
+            entity.Property(e => e.ChargeBoxId).HasMaxLength(50);
+            entity.Property(e => e.CreatedOn).HasColumnType("datetime");
+            entity.Property(e => e.UploadFileId)
+                .IsRequired()
+                .HasMaxLength(36);
 
+            entity.HasOne(d => d.UploadFile).WithMany(p => p.MachineVersionFiles)
+                .HasForeignKey(d => d.UploadFileId)
+                .HasConstraintName("FK_dbo.MachineVersionFile_dbo.UploadFile_UploadFileId");
+        });
 
-        public virtual DbSet<ServerMessage> ServerMessage { get; set; }
+        modelBuilder.Entity<MigrationHistory>(entity =>
+        {
+            entity.HasKey(e => new { e.MigrationId, e.ContextKey }).HasName("PK_dbo.__MigrationHistory");
 
-        public virtual DbSet<TransactionRecord> TransactionRecord { get; set; }
+            entity.ToTable("__MigrationHistory");
 
-        public virtual DbSet<UploadFile> UploadFile { get; set; }
+            entity.Property(e => e.MigrationId).HasMaxLength(150);
+            entity.Property(e => e.ContextKey).HasMaxLength(300);
+            entity.Property(e => e.Model).IsRequired();
+            entity.Property(e => e.ProductVersion)
+                .IsRequired()
+                .HasMaxLength(32);
+        });
 
-        protected override void OnModelCreating(ModelBuilder modelBuilder)
+        modelBuilder.Entity<Ocmf>(entity =>
         {
+            entity.HasKey(e => e.Id).HasName("PK_dbo.OCMF");
 
-            modelBuilder.Entity<Machine>().Property(x => x.RatedPower).HasPrecision(6, 2);
-            modelBuilder.Entity<Machine>().Property(x => x.Longitude).HasPrecision(10, 6);
-            modelBuilder.Entity<Machine>().Property(x => x.Latitude).HasPrecision(10, 6);
-            modelBuilder.Entity<ConnectorStatus>().Property(x => x.TotalEnergy).HasPrecision(10, 2);
-            base.OnModelCreating(modelBuilder);
+            entity.ToTable("OCMF");
 
-        }
+            entity.Property(e => e.DataString).HasMaxLength(2048);
+            entity.Property(e => e.PublicKey).HasMaxLength(256);
+        });
 
-        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
+        modelBuilder.Entity<ServerMessage>(entity =>
         {
-            //optionsBuilder.UseSqlServer("data source=172.1.2.187;initial catalog=StandardOCPP_Main;;persist security info=True;user id=sa;password=Ph0930118811;MultipleActiveResultSets=True;App=EntityFramework");
-            base.OnConfiguring(optionsBuilder);
-        }
+            entity.HasKey(e => e.Id).HasName("PK_dbo.ServerMessage");
+
+            entity.ToTable("ServerMessage");
+
+            entity.HasIndex(e => new { e.ReceivedOn, e.UpdatedOn, e.CreatedOn }, "nci_wi_ServerMessage_EC00C205420F6CB01974705B93F9507F");
+
+            entity.Property(e => e.ChargeBoxId).HasMaxLength(50);
+            entity.Property(e => e.CreatedBy).HasMaxLength(36);
+            entity.Property(e => e.CreatedOn).HasColumnType("datetime");
+            entity.Property(e => e.OutAction).HasMaxLength(30);
+            entity.Property(e => e.ReceivedOn).HasColumnType("datetime");
+            entity.Property(e => e.SerialNo).HasMaxLength(36);
+            entity.Property(e => e.UpdatedOn).HasColumnType("datetime");
+        });
+
+        modelBuilder.Entity<TransactionRecord>(entity =>
+        {
+            entity.HasKey(e => e.Id).HasName("PK_dbo.TransactionRecord");
+
+            entity.ToTable("TransactionRecord");
+
+            entity.HasIndex(e => new { e.CustomerId, e.ConnectorId, e.StartTime, e.ChargeBoxId }, "IX_TransactionRecord_StartTime");
+
+            entity.HasIndex(e => new { e.CustomerId, e.StopTransactionReportedOn, e.StopTime }, "nci_wi_TransactionRecord_92D4DF08E7034102014AC91760F890FE");
+
+            entity.Property(e => e.ChargeBoxId)
+                .IsRequired()
+                .HasMaxLength(50);
+            entity.Property(e => e.Cost).HasColumnType("decimal(18, 2)");
+            entity.Property(e => e.CreatedOn).HasColumnType("datetime");
+            entity.Property(e => e.Evccid)
+                .HasMaxLength(30)
+                .HasColumnName("EVCCID");
+            entity.Property(e => e.Fee).HasMaxLength(1500);
+            entity.Property(e => e.MeterStart).HasColumnType("decimal(18, 2)");
+            entity.Property(e => e.MeterStop).HasColumnType("decimal(18, 2)");
+            entity.Property(e => e.Receipt).HasMaxLength(3000);
+            entity.Property(e => e.StartIdTag).HasMaxLength(20);
+            entity.Property(e => e.StartSoc)
+                .HasMaxLength(3)
+                .HasColumnName("StartSOC");
+            entity.Property(e => e.StartTime).HasColumnType("datetime");
+            entity.Property(e => e.StartTransactionReportedOn).HasColumnType("datetime");
+            entity.Property(e => e.StopIdTag).HasMaxLength(20);
+            entity.Property(e => e.StopReason).HasMaxLength(60);
+            entity.Property(e => e.StopSoc)
+                .HasMaxLength(3)
+                .HasColumnName("StopSOC");
+            entity.Property(e => e.StopTime).HasColumnType("datetime");
+            entity.Property(e => e.StopTransactionReportedOn).HasColumnType("datetime");
+            entity.Property(e => e.UpdatedOn).HasColumnType("datetime");
+            entity.Property(e => e.UploadedtoTtia).HasColumnName("UploadedtoTTIA");
+        });
+
+        modelBuilder.Entity<UploadFile>(entity =>
+        {
+            entity.HasKey(e => e.Id).HasName("PK_dbo.UploadFile");
+
+            entity.ToTable("UploadFile");
+
+            entity.Property(e => e.Id).HasMaxLength(36);
+            entity.Property(e => e.CreatedBy).HasMaxLength(50);
+            entity.Property(e => e.CreatedOn).HasColumnType("datetime");
+            entity.Property(e => e.FileExtensionName).HasMaxLength(50);
+            entity.Property(e => e.FileMd5)
+                .HasMaxLength(50)
+                .HasColumnName("FileMD5");
+            entity.Property(e => e.FileName)
+                .IsRequired()
+                .HasMaxLength(500);
+            entity.Property(e => e.FilePath)
+                .IsRequired()
+                .HasMaxLength(500);
+            entity.Property(e => e.FileType).HasMaxLength(200);
+            entity.Property(e => e.FileUrl).HasMaxLength(512);
+            entity.Property(e => e.ModelName)
+                .IsRequired()
+                .HasMaxLength(50);
+            entity.Property(e => e.OriginName)
+                .IsRequired()
+                .HasMaxLength(500);
+            entity.Property(e => e.VendorId)
+                .IsRequired()
+                .HasMaxLength(50);
+        });
+
+        modelBuilder.Entity<VConnectorStatus>(entity =>
+        {
+            entity
+                .HasNoKey()
+                .ToView("vConnectorStatus");
+
+            entity.Property(e => e.ChargeBoxId).HasMaxLength(50);
+            entity.Property(e => e.CreatedOn).HasColumnType("datetime");
+            entity.Property(e => e.ErrorInfo).HasMaxLength(50);
+            entity.Property(e => e.Id)
+                .IsRequired()
+                .HasMaxLength(36);
+            entity.Property(e => e.TotalEnergy).HasColumnType("decimal(10, 2)");
+            entity.Property(e => e.VendorErrorCode).HasMaxLength(100);
+            entity.Property(e => e.VendorId).HasMaxLength(255);
+        });
+
+        modelBuilder.Entity<VConnectorStatusCombind>(entity =>
+        {
+            entity
+                .HasNoKey()
+                .ToView("vConnectorStatusCombind");
+
+            entity.Property(e => e.ChargeBoxId).HasMaxLength(50);
+            entity.Property(e => e.Ocpp)
+                .IsRequired()
+                .HasMaxLength(3)
+                .IsUnicode(false)
+                .HasColumnName("OCPP");
+            entity.Property(e => e.TotalEnergy).HasColumnType("decimal(10, 2)");
+            entity.Property(e => e.VendorErrorCode).HasMaxLength(100);
+        });
+
+        modelBuilder.Entity<VMachine>(entity =>
+        {
+            entity
+                .HasNoKey()
+                .ToView("vMachine");
+
+            entity.Property(e => e.ChargeBoxId).HasMaxLength(50);
+            entity.Property(e => e.ConnectorType).HasMaxLength(50);
+            entity.Property(e => e.HeartbeatUpdatedOn).HasColumnType("datetime");
+            entity.Property(e => e.Id)
+                .IsRequired()
+                .HasMaxLength(36);
+            entity.Property(e => e.ModelName)
+                .IsRequired()
+                .HasMaxLength(50);
+            entity.Property(e => e.OfflineOn).HasColumnType("datetime");
+            entity.Property(e => e.RatedPower).HasColumnType("decimal(6, 2)");
+            entity.Property(e => e.Ttiatag).HasColumnName("TTIATag");
+            entity.Property(e => e.VendorId).HasMaxLength(50);
+        });
+
+        modelBuilder.Entity<VMachineCombind>(entity =>
+        {
+            entity
+                .HasNoKey()
+                .ToView("vMachineCombind");
+
+            entity.Property(e => e.ChargeBoxId).HasMaxLength(50);
+            entity.Property(e => e.ConnectorType).HasMaxLength(50);
+            entity.Property(e => e.HeartbeatUpdatedOn).HasColumnType("datetime");
+            entity.Property(e => e.Id)
+                .IsRequired()
+                .HasMaxLength(36);
+            entity.Property(e => e.ModelName)
+                .IsRequired()
+                .HasMaxLength(50);
+            entity.Property(e => e.Ocpp)
+                .IsRequired()
+                .HasMaxLength(3)
+                .IsUnicode(false)
+                .HasColumnName("OCPP");
+            entity.Property(e => e.OfflineOn).HasColumnType("datetime");
+            entity.Property(e => e.RatedPower).HasColumnType("decimal(6, 2)");
+            entity.Property(e => e.Ttiatag).HasColumnName("TTIATag");
+            entity.Property(e => e.VendorId).HasMaxLength(50);
+        });
+
+        OnModelCreatingPartial(modelBuilder);
     }
-}
+
+    partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
+}

+ 33 - 37
EVCB_OCPP.Domain/MeterValueDBContext.cs

@@ -1,46 +1,42 @@
-namespace EVCB_OCPP.Domain
-{
-    using EVCB_OCPP.Domain.Models.Database;
-    using Microsoft.EntityFrameworkCore;
-    using System;
-    using System.Linq;
+using System;
+using System.Collections.Generic;
+using EVCB_OCPP.Domain.Models.MeterValueDb;
+using Microsoft.EntityFrameworkCore;
+
+namespace EVCB_OCPP.Domain;
 
-    public class MeterValueDBContext : DbContext
+public partial class MeterValueDBContext : DbContext
+{
+    public MeterValueDBContext()
     {
-        // 您的內容已設定為使用應用程式組態檔 (App.config 或 Web.config)
-        // 中的 'MeterValueDBContext' 連接字串。根據預設,這個連接字串的目標是
-        // 您的 LocalDb 執行個體上的 'EVCB_OCPP.Domain.MeterValueDBContext' 資料庫。
-        // 
-        // 如果您的目標是其他資料庫和 (或) 提供者,請修改
-        // 應用程式組態檔中的 'MeterValueDBContext' 連接字串。
-        public MeterValueDBContext() : base()
-        {
-            //this.Database.AutoTransactionBehavior = AutoTransactionBehavior.Never;
-        }
+    }
 
-        /// <summary>
-        /// DB coneection set
-        /// </summary>
-        public MeterValueDBContext(DbContextOptions<MeterValueDBContext> options) : base(options)
-        {
-            //this.Database.AutoTransactionBehavior = AutoTransactionBehavior.Never;
-        }
+    public MeterValueDBContext(DbContextOptions<MeterValueDBContext> options)
+        : base(options)
+    {
+    }
 
-        // 針對您要包含在模型中的每種實體類型新增 DbSet。如需有關設定和使用
-        // Code First 模型的詳細資訊,請參閱 http://go.microsoft.com/fwlink/?LinkId=390109。
+//    protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
+//#warning To protect potentially sensitive information in your connection string, you should move it out of source code. You can avoid scaffolding the connection string by using the Name= syntax to read it from configuration - see https://go.microsoft.com/fwlink/?linkid=2131148. For more guidance on storing connection strings, see http://go.microsoft.com/fwlink/?LinkId=723263.
+//        => optionsBuilder.UseSqlServer("data source=zerova-ev-dev.database.windows.net;initial catalog=StandardOCPP_MeterValue;persist security info=True;user id=azdevsoftware;password=1h52dev#az;MultipleActiveResultSets=True;App=EntityFramework");
 
-        public virtual DbSet<ConnectorMeterValueRecord> ConnectorMeterValueRecord { get; set; }
+    protected override void OnModelCreating(ModelBuilder modelBuilder)
+    {
+        modelBuilder.UseCollation("Chinese_Taiwan_Stroke_CI_AS");
 
-        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
+        modelBuilder.Entity<ConnectorMeterValueRecord>(entity =>
         {
-            //optionsBuilder.UseSqlServer("data source=172.1.2.187;initial catalog=StandardOCPP_MeterValue;;persist security info=True;user id=sa;password=Ph0930118811;MultipleActiveResultSets=True;App=EntityFramework");
-            base.OnConfiguring(optionsBuilder);
-        }
+            entity
+                .HasNoKey()
+                .ToTable("ConnectorMeterValueRecord");
+
+            entity.Property(e => e.ChargeBoxId).HasMaxLength(50);
+            entity.Property(e => e.CreatedOn).HasColumnType("smalldatetime");
+            entity.Property(e => e.Value).HasMaxLength(10);
+        });
+
+        OnModelCreatingPartial(modelBuilder);
     }
 
-    //public class MyEntity
-    //{
-    //    public int Id { get; set; }
-    //    public string Name { get; set; }
-    //}
-}
+    partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
+}

+ 1074 - 0
EVCB_OCPP.Domain/Migrations/20231019085717_InitialCreate.Designer.cs

@@ -0,0 +1,1074 @@
+// <auto-generated />
+using System;
+using EVCB_OCPP.Domain;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Metadata;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+
+#nullable disable
+
+namespace EVCB_OCPP.Domain.Migrations
+{
+    [DbContext(typeof(MainDBContext))]
+    [Migration("20231019085717_InitialCreate")]
+    partial class InitialCreate
+    {
+        /// <inheritdoc />
+        protected override void BuildTargetModel(ModelBuilder modelBuilder)
+        {
+#pragma warning disable 612, 618
+            modelBuilder
+                .UseCollation("Chinese_Taiwan_Stroke_CI_AS")
+                .HasAnnotation("ProductVersion", "7.0.12")
+                .HasAnnotation("Relational:MaxIdentifierLength", 128);
+
+            SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
+
+            modelBuilder.Entity("EVCB_OCPP.Domain.Models.MainDb.ConnectorMeterValueRecord", b =>
+                {
+                    b.Property<long>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("bigint");
+
+                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"));
+
+                    b.Property<string>("ChargeBoxId")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<byte>("ConnectorId")
+                        .HasColumnType("tinyint");
+
+                    b.Property<int>("ContextId")
+                        .HasColumnType("int");
+
+                    b.Property<DateTime>("CreatedOn")
+                        .HasColumnType("datetime");
+
+                    b.Property<int>("FormatId")
+                        .HasColumnType("int");
+
+                    b.Property<int>("LocationId")
+                        .HasColumnType("int");
+
+                    b.Property<int>("MeasurandId")
+                        .HasColumnType("int");
+
+                    b.Property<int>("PhaseId")
+                        .HasColumnType("int");
+
+                    b.Property<int>("TransactionId")
+                        .HasColumnType("int");
+
+                    b.Property<int>("UnitId")
+                        .HasColumnType("int");
+
+                    b.Property<string>("Value")
+                        .HasMaxLength(10)
+                        .HasColumnType("nvarchar(10)");
+
+                    b.HasKey("Id")
+                        .HasName("PK_dbo.ConnectorMeterValueRecord");
+
+                    b.ToTable("ConnectorMeterValueRecord", (string)null);
+                });
+
+            modelBuilder.Entity("EVCB_OCPP.Domain.Models.MainDb.ConnectorStatus", b =>
+                {
+                    b.Property<string>("Id")
+                        .HasMaxLength(36)
+                        .HasColumnType("nvarchar(36)");
+
+                    b.Property<string>("ChargeBoxId")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<int>("ChargePointErrorCodeId")
+                        .HasColumnType("int");
+
+                    b.Property<byte>("ConnectorId")
+                        .HasColumnType("tinyint");
+
+                    b.Property<DateTime>("CreatedOn")
+                        .HasColumnType("datetime");
+
+                    b.Property<string>("ErrorInfo")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<int>("Status")
+                        .HasColumnType("int");
+
+                    b.Property<decimal>("TotalEnergy")
+                        .HasColumnType("decimal(10, 2)");
+
+                    b.Property<int>("Type")
+                        .HasColumnType("int");
+
+                    b.Property<string>("VendorErrorCode")
+                        .HasMaxLength(100)
+                        .HasColumnType("nvarchar(100)");
+
+                    b.Property<string>("VendorId")
+                        .HasMaxLength(255)
+                        .HasColumnType("nvarchar(255)");
+
+                    b.HasKey("Id")
+                        .HasName("PK_dbo.ConnectorStatus");
+
+                    b.HasIndex(new[] { "ChargeBoxId", "ConnectorId" }, "IX_ConnectorStatus")
+                        .IsUnique()
+                        .HasFilter("[ChargeBoxId] IS NOT NULL");
+
+                    b.ToTable("ConnectorStatus", (string)null);
+                });
+
+            modelBuilder.Entity("EVCB_OCPP.Domain.Models.MainDb.Customer", b =>
+                {
+                    b.Property<Guid>("Id")
+                        .HasColumnType("uniqueidentifier");
+
+                    b.Property<string>("ApiCustomerId")
+                        .HasMaxLength(36)
+                        .HasColumnType("nvarchar(36)");
+
+                    b.Property<string>("ApiKey")
+                        .HasMaxLength(128)
+                        .HasColumnType("nvarchar(128)");
+
+                    b.Property<DateTime?>("ApiKeyUpdatedOn")
+                        .HasColumnType("datetime");
+
+                    b.Property<string>("ApiUrl")
+                        .HasMaxLength(256)
+                        .HasColumnType("nvarchar(256)");
+
+                    b.Property<bool>("CallPartnerApiOnSchedule")
+                        .HasColumnType("bit");
+
+                    b.Property<string>("CreatedBy")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<DateTime>("CreatedOn")
+                        .HasColumnType("datetime");
+
+                    b.Property<DateTime?>("Deadline")
+                        .HasColumnType("datetime");
+
+                    b.Property<bool>("EnableTtia")
+                        .HasColumnType("bit")
+                        .HasColumnName("EnableTTIA");
+
+                    b.Property<string>("Ftphost")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)")
+                        .HasColumnName("FTPHost");
+
+                    b.Property<string>("Ftppassword")
+                        .HasMaxLength(20)
+                        .HasColumnType("nvarchar(20)")
+                        .HasColumnName("FTPPassword");
+
+                    b.Property<string>("Ftppath")
+                        .HasColumnType("nvarchar(max)")
+                        .HasColumnName("FTPPath");
+
+                    b.Property<string>("Ftpuser")
+                        .HasMaxLength(20)
+                        .HasColumnType("nvarchar(20)")
+                        .HasColumnName("FTPUser");
+
+                    b.Property<bool>("InstantStopTxReport")
+                        .HasColumnType("bit");
+
+                    b.Property<bool>("IsShow")
+                        .HasColumnType("bit");
+
+                    b.Property<string>("Name")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<string>("PartnerId")
+                        .HasMaxLength(36)
+                        .HasColumnType("nvarchar(36)");
+
+                    b.Property<string>("TtiaApikey")
+                        .HasMaxLength(10)
+                        .HasColumnType("nvarchar(10)")
+                        .HasColumnName("TTIA_APIKey");
+
+                    b.Property<string>("TtiaApiurl")
+                        .HasMaxLength(100)
+                        .HasColumnType("nvarchar(100)")
+                        .HasColumnName("TTIA_APIUrl");
+
+                    b.Property<int>("TtiaCustomerId")
+                        .HasColumnType("int")
+                        .HasColumnName("TTIA_CustomerId");
+
+                    b.Property<string>("TtiaEquipmentProvider")
+                        .HasMaxLength(10)
+                        .HasColumnType("nvarchar(10)")
+                        .HasColumnName("TTIA_EquipmentProvider");
+
+                    b.Property<string>("UpdatedBy")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<DateTime?>("UpdatedOn")
+                        .HasColumnType("datetime");
+
+                    b.HasKey("Id")
+                        .HasName("PK_dbo.Customer");
+
+                    b.ToTable("Customer", (string)null);
+                });
+
+            modelBuilder.Entity("EVCB_OCPP.Domain.Models.MainDb.LoadingBalance", b =>
+                {
+                    b.Property<long>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("bigint");
+
+                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"));
+
+                    b.Property<DateTime>("CreatedOn")
+                        .HasColumnType("datetime");
+
+                    b.Property<DateTime>("FinishedOn")
+                        .HasColumnType("datetime");
+
+                    b.Property<string>("MachineId")
+                        .IsRequired()
+                        .HasMaxLength(36)
+                        .HasColumnType("nvarchar(36)");
+
+                    b.Property<decimal>("Power")
+                        .HasColumnType("decimal(10, 2)");
+
+                    b.Property<int>("StationId")
+                        .HasColumnType("int");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("LoadingBalance", (string)null);
+                });
+
+            modelBuilder.Entity("EVCB_OCPP.Domain.Models.MainDb.Machine", b =>
+                {
+                    b.Property<string>("Id")
+                        .HasMaxLength(36)
+                        .HasColumnType("nvarchar(36)");
+
+                    b.Property<string>("BoardVersions")
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("ChargeBoxId")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<string>("ChargeBoxSerialNumber")
+                        .HasMaxLength(25)
+                        .HasColumnType("nvarchar(25)");
+
+                    b.Property<string>("ChargePointModel")
+                        .HasMaxLength(20)
+                        .HasColumnType("nvarchar(20)");
+
+                    b.Property<string>("ChargePointSerialNumber")
+                        .HasMaxLength(25)
+                        .HasColumnType("nvarchar(25)");
+
+                    b.Property<string>("ChargePointVendor")
+                        .HasMaxLength(20)
+                        .HasColumnType("nvarchar(20)");
+
+                    b.Property<string>("Comment")
+                        .HasMaxLength(100)
+                        .HasColumnType("nvarchar(100)");
+
+                    b.Property<int>("ConnectionType")
+                        .HasColumnType("int");
+
+                    b.Property<string>("ConnectorPowerType")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<string>("ConnectorType")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<string>("CreatedBy")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<DateTime>("CreatedOn")
+                        .HasColumnType("datetime");
+
+                    b.Property<Guid>("CustomerId")
+                        .HasColumnType("uniqueidentifier");
+
+                    b.Property<int?>("FwAssignedVersion")
+                        .HasColumnType("int")
+                        .HasColumnName("FW_AssignedVersion");
+
+                    b.Property<string>("FwCurrentVersion")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)")
+                        .HasColumnName("FW_CurrentVersion");
+
+                    b.Property<int?>("FwVersionReport")
+                        .HasColumnType("int")
+                        .HasColumnName("FW_VersionReport");
+
+                    b.Property<int>("GunAmt")
+                        .HasColumnType("int");
+
+                    b.Property<DateTime>("HeartbeatUpdatedOn")
+                        .HasColumnType("datetime");
+
+                    b.Property<string>("Iccid")
+                        .HasMaxLength(20)
+                        .HasColumnType("nvarchar(20)");
+
+                    b.Property<string>("Imsi")
+                        .HasMaxLength(20)
+                        .HasColumnType("nvarchar(20)");
+
+                    b.Property<bool>("IsDelete")
+                        .HasColumnType("bit");
+
+                    b.Property<decimal>("Latitude")
+                        .HasColumnType("decimal(10, 6)");
+
+                    b.Property<decimal>("Longitude")
+                        .HasColumnType("decimal(10, 6)");
+
+                    b.Property<string>("MeterSerialNumber")
+                        .HasMaxLength(25)
+                        .HasColumnType("nvarchar(25)");
+
+                    b.Property<string>("MeterType")
+                        .HasMaxLength(25)
+                        .HasColumnType("nvarchar(25)");
+
+                    b.Property<string>("ModelName")
+                        .IsRequired()
+                        .ValueGeneratedOnAdd()
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)")
+                        .HasDefaultValueSql("('')");
+
+                    b.Property<DateTime?>("OfflineOn")
+                        .HasColumnType("datetime");
+
+                    b.Property<bool>("Online")
+                        .HasColumnType("bit");
+
+                    b.Property<decimal>("RatedPower")
+                        .HasColumnType("decimal(6, 2)");
+
+                    b.Property<int>("Ttiatag")
+                        .HasColumnType("int")
+                        .HasColumnName("TTIATag");
+
+                    b.Property<string>("VendorId")
+                        .ValueGeneratedOnAdd()
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)")
+                        .HasDefaultValueSql("('Zerova')");
+
+                    b.HasKey("Id")
+                        .HasName("PK_dbo.Machine");
+
+                    b.HasIndex(new[] { "CustomerId", "ChargeBoxId" }, "nci_wi_Machine_7CD4A9D1688F96F6967B2244A0666F62");
+
+                    b.ToTable("Machine", (string)null);
+                });
+
+            modelBuilder.Entity("EVCB_OCPP.Domain.Models.MainDb.MachineConfiguration", b =>
+                {
+                    b.Property<string>("ConfigureName")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<string>("ChargeBoxId")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<string>("ConfigureSetting")
+                        .HasMaxLength(500)
+                        .HasColumnType("nvarchar(500)");
+
+                    b.Property<bool>("Exists")
+                        .HasColumnType("bit");
+
+                    b.Property<int>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("int");
+
+                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
+
+                    b.Property<bool>("ReadOnly")
+                        .HasColumnType("bit");
+
+                    b.HasKey("ConfigureName", "ChargeBoxId")
+                        .HasName("PK_dbo.MachineConfigurations");
+
+                    b.HasIndex(new[] { "ConfigureName", "ConfigureSetting" }, "nci_wi_MachineConfigurations_132E765C043BF95A2570D2EA019DD783");
+
+                    b.ToTable("MachineConfigurations");
+                });
+
+            modelBuilder.Entity("EVCB_OCPP.Domain.Models.MainDb.MachineError", b =>
+                {
+                    b.Property<int>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("int");
+
+                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
+
+                    b.Property<string>("ChargeBoxId")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<byte>("ConnectorId")
+                        .HasColumnType("tinyint");
+
+                    b.Property<DateTime>("CreatedOn")
+                        .HasColumnType("datetime");
+
+                    b.Property<int>("ErrorCodeId")
+                        .HasColumnType("int");
+
+                    b.Property<string>("ErrorInfo")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<int>("PreStatus")
+                        .HasColumnType("int");
+
+                    b.Property<int>("Status")
+                        .HasColumnType("int");
+
+                    b.Property<string>("VendorErrorCode")
+                        .HasMaxLength(100)
+                        .HasColumnType("nvarchar(100)");
+
+                    b.Property<string>("VendorId")
+                        .HasMaxLength(255)
+                        .HasColumnType("nvarchar(255)");
+
+                    b.HasKey("Id")
+                        .HasName("PK_dbo.MachineError");
+
+                    b.ToTable("MachineError", (string)null);
+                });
+
+            modelBuilder.Entity("EVCB_OCPP.Domain.Models.MainDb.MachineOperateRecord", b =>
+                {
+                    b.Property<int>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("int");
+
+                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
+
+                    b.Property<string>("Action")
+                        .HasMaxLength(30)
+                        .HasColumnType("nvarchar(30)");
+
+                    b.Property<string>("ChargeBoxId")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<DateTime>("CreatedOn")
+                        .HasColumnType("datetime");
+
+                    b.Property<int>("EvseStatus")
+                        .HasColumnType("int")
+                        .HasColumnName("EVSE_Status");
+
+                    b.Property<string>("EvseValue")
+                        .HasColumnType("nvarchar(max)")
+                        .HasColumnName("EVSE_Value");
+
+                    b.Property<DateTime>("FinishedOn")
+                        .HasColumnType("datetime");
+
+                    b.Property<DateTime>("ReportedOn")
+                        .HasColumnType("datetime");
+
+                    b.Property<string>("RequestContent")
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<int>("RequestType")
+                        .HasColumnType("int");
+
+                    b.Property<string>("SerialNo")
+                        .HasMaxLength(36)
+                        .HasColumnType("nvarchar(36)");
+
+                    b.Property<int>("Status")
+                        .HasColumnType("int");
+
+                    b.HasKey("Id")
+                        .HasName("PK_dbo.MachineOperateRecord");
+
+                    b.ToTable("MachineOperateRecord", (string)null);
+                });
+
+            modelBuilder.Entity("EVCB_OCPP.Domain.Models.MainDb.MachineVersionFile", b =>
+                {
+                    b.Property<int>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("int");
+
+                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
+
+                    b.Property<string>("ChargeBoxId")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<DateTime>("CreatedOn")
+                        .HasColumnType("datetime");
+
+                    b.Property<int>("Seq")
+                        .HasColumnType("int");
+
+                    b.Property<string>("UploadFileId")
+                        .IsRequired()
+                        .HasMaxLength(36)
+                        .HasColumnType("nvarchar(36)");
+
+                    b.HasKey("Id")
+                        .HasName("PK_dbo.MachineVersionFile");
+
+                    b.HasIndex("UploadFileId");
+
+                    b.ToTable("MachineVersionFile", (string)null);
+                });
+
+            modelBuilder.Entity("EVCB_OCPP.Domain.Models.MainDb.MigrationHistory", b =>
+                {
+                    b.Property<string>("MigrationId")
+                        .HasMaxLength(150)
+                        .HasColumnType("nvarchar(150)");
+
+                    b.Property<string>("ContextKey")
+                        .HasMaxLength(300)
+                        .HasColumnType("nvarchar(300)");
+
+                    b.Property<byte[]>("Model")
+                        .IsRequired()
+                        .HasColumnType("varbinary(max)");
+
+                    b.Property<string>("ProductVersion")
+                        .IsRequired()
+                        .HasMaxLength(32)
+                        .HasColumnType("nvarchar(32)");
+
+                    b.HasKey("MigrationId", "ContextKey")
+                        .HasName("PK_dbo.__MigrationHistory");
+
+                    b.ToTable("__MigrationHistory", (string)null);
+                });
+
+            modelBuilder.Entity("EVCB_OCPP.Domain.Models.MainDb.Ocmf", b =>
+                {
+                    b.Property<int>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("int");
+
+                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
+
+                    b.Property<string>("DataString")
+                        .HasMaxLength(2048)
+                        .HasColumnType("nvarchar(2048)");
+
+                    b.Property<string>("PublicKey")
+                        .HasMaxLength(256)
+                        .HasColumnType("nvarchar(256)");
+
+                    b.Property<int>("TransactionId")
+                        .HasColumnType("int");
+
+                    b.HasKey("Id")
+                        .HasName("PK_dbo.OCMF");
+
+                    b.ToTable("OCMF", (string)null);
+                });
+
+            modelBuilder.Entity("EVCB_OCPP.Domain.Models.MainDb.ServerMessage", b =>
+                {
+                    b.Property<int>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("int");
+
+                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
+
+                    b.Property<string>("ChargeBoxId")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<string>("CreatedBy")
+                        .HasMaxLength(36)
+                        .HasColumnType("nvarchar(36)");
+
+                    b.Property<DateTime>("CreatedOn")
+                        .HasColumnType("datetime");
+
+                    b.Property<string>("InMessage")
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("OutAction")
+                        .HasMaxLength(30)
+                        .HasColumnType("nvarchar(30)");
+
+                    b.Property<string>("OutRequest")
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<DateTime>("ReceivedOn")
+                        .HasColumnType("datetime");
+
+                    b.Property<string>("SerialNo")
+                        .HasMaxLength(36)
+                        .HasColumnType("nvarchar(36)");
+
+                    b.Property<DateTime>("UpdatedOn")
+                        .HasColumnType("datetime");
+
+                    b.HasKey("Id")
+                        .HasName("PK_dbo.ServerMessage");
+
+                    b.HasIndex(new[] { "ReceivedOn", "UpdatedOn", "CreatedOn" }, "nci_wi_ServerMessage_EC00C205420F6CB01974705B93F9507F");
+
+                    b.ToTable("ServerMessage", (string)null);
+                });
+
+            modelBuilder.Entity("EVCB_OCPP.Domain.Models.MainDb.TransactionRecord", b =>
+                {
+                    b.Property<int>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("int");
+
+                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
+
+                    b.Property<bool>("BillingDone")
+                        .HasColumnType("bit");
+
+                    b.Property<string>("ChargeBoxId")
+                        .IsRequired()
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<byte>("ConnectorId")
+                        .HasColumnType("tinyint");
+
+                    b.Property<decimal>("Cost")
+                        .HasColumnType("decimal(18, 2)");
+
+                    b.Property<DateTime>("CreatedOn")
+                        .HasColumnType("datetime");
+
+                    b.Property<Guid>("CustomerId")
+                        .HasColumnType("uniqueidentifier");
+
+                    b.Property<string>("ErrorMsg")
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("Evccid")
+                        .HasMaxLength(30)
+                        .HasColumnType("nvarchar(30)")
+                        .HasColumnName("EVCCID");
+
+                    b.Property<string>("Fee")
+                        .HasMaxLength(1500)
+                        .HasColumnType("nvarchar(1500)");
+
+                    b.Property<decimal>("MeterStart")
+                        .HasColumnType("decimal(18, 2)");
+
+                    b.Property<decimal>("MeterStop")
+                        .HasColumnType("decimal(18, 2)");
+
+                    b.Property<bool>("NotifyPnC")
+                        .HasColumnType("bit");
+
+                    b.Property<string>("Receipt")
+                        .HasMaxLength(3000)
+                        .HasColumnType("nvarchar(3000)");
+
+                    b.Property<int>("ReservationId")
+                        .HasColumnType("int");
+
+                    b.Property<int>("RetryStartTransactionTimes")
+                        .HasColumnType("int");
+
+                    b.Property<int>("RetryStopTransactionTimes")
+                        .HasColumnType("int");
+
+                    b.Property<string>("StartIdTag")
+                        .HasMaxLength(20)
+                        .HasColumnType("nvarchar(20)");
+
+                    b.Property<string>("StartSoc")
+                        .HasMaxLength(3)
+                        .HasColumnType("nvarchar(3)")
+                        .HasColumnName("StartSOC");
+
+                    b.Property<DateTime>("StartTime")
+                        .HasColumnType("datetime");
+
+                    b.Property<DateTime>("StartTransactionReportedOn")
+                        .HasColumnType("datetime");
+
+                    b.Property<string>("StopIdTag")
+                        .HasMaxLength(20)
+                        .HasColumnType("nvarchar(20)");
+
+                    b.Property<string>("StopReason")
+                        .HasMaxLength(60)
+                        .HasColumnType("nvarchar(60)");
+
+                    b.Property<int>("StopReasonId")
+                        .HasColumnType("int");
+
+                    b.Property<string>("StopSoc")
+                        .HasMaxLength(3)
+                        .HasColumnType("nvarchar(3)")
+                        .HasColumnName("StopSOC");
+
+                    b.Property<DateTime>("StopTime")
+                        .HasColumnType("datetime");
+
+                    b.Property<DateTime>("StopTransactionReportedOn")
+                        .HasColumnType("datetime");
+
+                    b.Property<DateTime>("UpdatedOn")
+                        .HasColumnType("datetime");
+
+                    b.Property<bool>("UploadedtoTtia")
+                        .HasColumnType("bit")
+                        .HasColumnName("UploadedtoTTIA");
+
+                    b.HasKey("Id")
+                        .HasName("PK_dbo.TransactionRecord");
+
+                    b.HasIndex(new[] { "CustomerId", "ConnectorId", "StartTime", "ChargeBoxId" }, "IX_TransactionRecord_StartTime");
+
+                    b.HasIndex(new[] { "CustomerId", "StopTransactionReportedOn", "StopTime" }, "nci_wi_TransactionRecord_92D4DF08E7034102014AC91760F890FE");
+
+                    b.ToTable("TransactionRecord", (string)null);
+                });
+
+            modelBuilder.Entity("EVCB_OCPP.Domain.Models.MainDb.UploadFile", b =>
+                {
+                    b.Property<string>("Id")
+                        .HasMaxLength(36)
+                        .HasColumnType("nvarchar(36)");
+
+                    b.Property<string>("CreatedBy")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<DateTime>("CreatedOn")
+                        .HasColumnType("datetime");
+
+                    b.Property<string>("FileExtensionName")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<string>("FileMd5")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)")
+                        .HasColumnName("FileMD5");
+
+                    b.Property<string>("FileName")
+                        .IsRequired()
+                        .HasMaxLength(500)
+                        .HasColumnType("nvarchar(500)");
+
+                    b.Property<string>("FilePath")
+                        .IsRequired()
+                        .HasMaxLength(500)
+                        .HasColumnType("nvarchar(500)");
+
+                    b.Property<int>("FileSize")
+                        .HasColumnType("int");
+
+                    b.Property<string>("FileType")
+                        .HasMaxLength(200)
+                        .HasColumnType("nvarchar(200)");
+
+                    b.Property<string>("FileUrl")
+                        .HasMaxLength(512)
+                        .HasColumnType("nvarchar(512)");
+
+                    b.Property<string>("ModelName")
+                        .IsRequired()
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<int>("ModuleId")
+                        .HasColumnType("int");
+
+                    b.Property<string>("OriginName")
+                        .IsRequired()
+                        .HasMaxLength(500)
+                        .HasColumnType("nvarchar(500)");
+
+                    b.Property<string>("VendorId")
+                        .IsRequired()
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.HasKey("Id")
+                        .HasName("PK_dbo.UploadFile");
+
+                    b.ToTable("UploadFile", (string)null);
+                });
+
+            modelBuilder.Entity("EVCB_OCPP.Domain.Models.MainDb.VConnectorStatus", b =>
+                {
+                    b.Property<string>("ChargeBoxId")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<int>("ChargePointErrorCodeId")
+                        .HasColumnType("int");
+
+                    b.Property<byte>("ConnectorId")
+                        .HasColumnType("tinyint");
+
+                    b.Property<DateTime>("CreatedOn")
+                        .HasColumnType("datetime");
+
+                    b.Property<string>("ErrorInfo")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<string>("Id")
+                        .IsRequired()
+                        .HasMaxLength(36)
+                        .HasColumnType("nvarchar(36)");
+
+                    b.Property<int>("Status")
+                        .HasColumnType("int");
+
+                    b.Property<decimal>("TotalEnergy")
+                        .HasColumnType("decimal(10, 2)");
+
+                    b.Property<int>("Type")
+                        .HasColumnType("int");
+
+                    b.Property<string>("VendorErrorCode")
+                        .HasMaxLength(100)
+                        .HasColumnType("nvarchar(100)");
+
+                    b.Property<string>("VendorId")
+                        .HasMaxLength(255)
+                        .HasColumnType("nvarchar(255)");
+
+                    b.ToTable((string)null);
+
+                    b.ToView("vConnectorStatus", (string)null);
+                });
+
+            modelBuilder.Entity("EVCB_OCPP.Domain.Models.MainDb.VConnectorStatusCombind", b =>
+                {
+                    b.Property<string>("ChargeBoxId")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<int>("ChargePointErrorCodeId")
+                        .HasColumnType("int");
+
+                    b.Property<byte>("ConnectorId")
+                        .HasColumnType("tinyint");
+
+                    b.Property<string>("Ocpp")
+                        .IsRequired()
+                        .HasMaxLength(3)
+                        .IsUnicode(false)
+                        .HasColumnType("varchar(3)")
+                        .HasColumnName("OCPP");
+
+                    b.Property<int>("Status")
+                        .HasColumnType("int");
+
+                    b.Property<decimal>("TotalEnergy")
+                        .HasColumnType("decimal(10, 2)");
+
+                    b.Property<int>("Type")
+                        .HasColumnType("int");
+
+                    b.Property<string>("VendorErrorCode")
+                        .HasMaxLength(100)
+                        .HasColumnType("nvarchar(100)");
+
+                    b.ToTable((string)null);
+
+                    b.ToView("vConnectorStatusCombind", (string)null);
+                });
+
+            modelBuilder.Entity("EVCB_OCPP.Domain.Models.MainDb.VMachine", b =>
+                {
+                    b.Property<string>("ChargeBoxId")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<int>("ConnectionType")
+                        .HasColumnType("int");
+
+                    b.Property<string>("ConnectorType")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<Guid>("CustomerId")
+                        .HasColumnType("uniqueidentifier");
+
+                    b.Property<int>("GunAmt")
+                        .HasColumnType("int");
+
+                    b.Property<DateTime>("HeartbeatUpdatedOn")
+                        .HasColumnType("datetime");
+
+                    b.Property<string>("Id")
+                        .IsRequired()
+                        .HasMaxLength(36)
+                        .HasColumnType("nvarchar(36)");
+
+                    b.Property<bool>("IsDelete")
+                        .HasColumnType("bit");
+
+                    b.Property<string>("ModelName")
+                        .IsRequired()
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<DateTime?>("OfflineOn")
+                        .HasColumnType("datetime");
+
+                    b.Property<bool>("Online")
+                        .HasColumnType("bit");
+
+                    b.Property<decimal>("RatedPower")
+                        .HasColumnType("decimal(6, 2)");
+
+                    b.Property<int>("Ttiatag")
+                        .HasColumnType("int")
+                        .HasColumnName("TTIATag");
+
+                    b.Property<string>("VendorId")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.ToTable((string)null);
+
+                    b.ToView("vMachine", (string)null);
+                });
+
+            modelBuilder.Entity("EVCB_OCPP.Domain.Models.MainDb.VMachineCombind", b =>
+                {
+                    b.Property<string>("ChargeBoxId")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<int>("ConnectionType")
+                        .HasColumnType("int");
+
+                    b.Property<string>("ConnectorType")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<Guid>("CustomerId")
+                        .HasColumnType("uniqueidentifier");
+
+                    b.Property<int>("GunAmt")
+                        .HasColumnType("int");
+
+                    b.Property<DateTime>("HeartbeatUpdatedOn")
+                        .HasColumnType("datetime");
+
+                    b.Property<string>("Id")
+                        .IsRequired()
+                        .HasMaxLength(36)
+                        .HasColumnType("nvarchar(36)");
+
+                    b.Property<bool>("IsDelete")
+                        .HasColumnType("bit");
+
+                    b.Property<string>("ModelName")
+                        .IsRequired()
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<string>("Ocpp")
+                        .IsRequired()
+                        .HasMaxLength(3)
+                        .IsUnicode(false)
+                        .HasColumnType("varchar(3)")
+                        .HasColumnName("OCPP");
+
+                    b.Property<DateTime?>("OfflineOn")
+                        .HasColumnType("datetime");
+
+                    b.Property<bool>("Online")
+                        .HasColumnType("bit");
+
+                    b.Property<decimal>("RatedPower")
+                        .HasColumnType("decimal(6, 2)");
+
+                    b.Property<int>("Ttiatag")
+                        .HasColumnType("int")
+                        .HasColumnName("TTIATag");
+
+                    b.Property<string>("VendorId")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.ToTable((string)null);
+
+                    b.ToView("vMachineCombind", (string)null);
+                });
+
+            modelBuilder.Entity("EVCB_OCPP.Domain.Models.MainDb.Machine", b =>
+                {
+                    b.HasOne("EVCB_OCPP.Domain.Models.MainDb.Customer", "Customer")
+                        .WithMany("Machines")
+                        .HasForeignKey("CustomerId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired()
+                        .HasConstraintName("FK_dbo.Machine_dbo.Customer_CustomerId");
+
+                    b.Navigation("Customer");
+                });
+
+            modelBuilder.Entity("EVCB_OCPP.Domain.Models.MainDb.MachineVersionFile", b =>
+                {
+                    b.HasOne("EVCB_OCPP.Domain.Models.MainDb.UploadFile", "UploadFile")
+                        .WithMany("MachineVersionFiles")
+                        .HasForeignKey("UploadFileId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired()
+                        .HasConstraintName("FK_dbo.MachineVersionFile_dbo.UploadFile_UploadFileId");
+
+                    b.Navigation("UploadFile");
+                });
+
+            modelBuilder.Entity("EVCB_OCPP.Domain.Models.MainDb.Customer", b =>
+                {
+                    b.Navigation("Machines");
+                });
+
+            modelBuilder.Entity("EVCB_OCPP.Domain.Models.MainDb.UploadFile", b =>
+                {
+                    b.Navigation("MachineVersionFiles");
+                });
+#pragma warning restore 612, 618
+        }
+    }
+}

+ 438 - 0
EVCB_OCPP.Domain/Migrations/20231019085717_InitialCreate.cs

@@ -0,0 +1,438 @@
+using System;
+using Microsoft.EntityFrameworkCore.Migrations;
+
+#nullable disable
+
+namespace EVCB_OCPP.Domain.Migrations
+{
+    /// <inheritdoc />
+    public partial class InitialCreate : Migration
+    {
+        /// <inheritdoc />
+        protected override void Up(MigrationBuilder migrationBuilder)
+        {
+            migrationBuilder.CreateTable(
+                name: "__MigrationHistory",
+                columns: table => new
+                {
+                    MigrationId = table.Column<string>(type: "nvarchar(150)", maxLength: 150, nullable: false),
+                    ContextKey = table.Column<string>(type: "nvarchar(300)", maxLength: 300, nullable: false),
+                    Model = table.Column<byte[]>(type: "varbinary(max)", nullable: false),
+                    ProductVersion = table.Column<string>(type: "nvarchar(32)", maxLength: 32, nullable: false)
+                },
+                constraints: table =>
+                {
+                    table.PrimaryKey("PK_dbo.__MigrationHistory", x => new { x.MigrationId, x.ContextKey });
+                });
+
+            migrationBuilder.CreateTable(
+                name: "ConnectorMeterValueRecord",
+                columns: table => new
+                {
+                    Id = table.Column<long>(type: "bigint", nullable: false)
+                        .Annotation("SqlServer:Identity", "1, 1"),
+                    ConnectorId = table.Column<byte>(type: "tinyint", nullable: false),
+                    Value = table.Column<string>(type: "nvarchar(10)", maxLength: 10, nullable: true),
+                    CreatedOn = table.Column<DateTime>(type: "datetime", nullable: false),
+                    ContextId = table.Column<int>(type: "int", nullable: false),
+                    FormatId = table.Column<int>(type: "int", nullable: false),
+                    MeasurandId = table.Column<int>(type: "int", nullable: false),
+                    PhaseId = table.Column<int>(type: "int", nullable: false),
+                    LocationId = table.Column<int>(type: "int", nullable: false),
+                    UnitId = table.Column<int>(type: "int", nullable: false),
+                    ChargeBoxId = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
+                    TransactionId = table.Column<int>(type: "int", nullable: false)
+                },
+                constraints: table =>
+                {
+                    table.PrimaryKey("PK_dbo.ConnectorMeterValueRecord", x => x.Id);
+                });
+
+            migrationBuilder.CreateTable(
+                name: "ConnectorStatus",
+                columns: table => new
+                {
+                    Id = table.Column<string>(type: "nvarchar(36)", maxLength: 36, nullable: false),
+                    ConnectorId = table.Column<byte>(type: "tinyint", nullable: false),
+                    Status = table.Column<int>(type: "int", nullable: false),
+                    ErrorInfo = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
+                    VendorId = table.Column<string>(type: "nvarchar(255)", maxLength: 255, nullable: true),
+                    CreatedOn = table.Column<DateTime>(type: "datetime", nullable: false),
+                    VendorErrorCode = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
+                    ChargePointErrorCodeId = table.Column<int>(type: "int", nullable: false),
+                    ChargeBoxId = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
+                    TotalEnergy = table.Column<decimal>(type: "decimal(10,2)", nullable: false),
+                    Type = table.Column<int>(type: "int", nullable: false)
+                },
+                constraints: table =>
+                {
+                    table.PrimaryKey("PK_dbo.ConnectorStatus", x => x.Id);
+                });
+
+            migrationBuilder.CreateTable(
+                name: "Customer",
+                columns: table => new
+                {
+                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
+                    Name = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
+                    CreatedOn = table.Column<DateTime>(type: "datetime", nullable: false),
+                    CreatedBy = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
+                    Deadline = table.Column<DateTime>(type: "datetime", nullable: true),
+                    UpdatedOn = table.Column<DateTime>(type: "datetime", nullable: true),
+                    UpdatedBy = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
+                    ApiUrl = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
+                    ApiKey = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: true),
+                    ApiKeyUpdatedOn = table.Column<DateTime>(type: "datetime", nullable: true),
+                    PartnerId = table.Column<string>(type: "nvarchar(36)", maxLength: 36, nullable: true),
+                    ApiCustomerId = table.Column<string>(type: "nvarchar(36)", maxLength: 36, nullable: true),
+                    CallPartnerApiOnSchedule = table.Column<bool>(type: "bit", nullable: false),
+                    IsShow = table.Column<bool>(type: "bit", nullable: false),
+                    FTPPath = table.Column<string>(type: "nvarchar(max)", nullable: true),
+                    FTPHost = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
+                    FTPUser = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: true),
+                    FTPPassword = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: true),
+                    EnableTTIA = table.Column<bool>(type: "bit", nullable: false),
+                    TTIA_EquipmentProvider = table.Column<string>(type: "nvarchar(10)", maxLength: 10, nullable: true),
+                    TTIA_CustomerId = table.Column<int>(type: "int", nullable: false),
+                    TTIA_APIUrl = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
+                    TTIA_APIKey = table.Column<string>(type: "nvarchar(10)", maxLength: 10, nullable: true),
+                    InstantStopTxReport = table.Column<bool>(type: "bit", nullable: false)
+                },
+                constraints: table =>
+                {
+                    table.PrimaryKey("PK_dbo.Customer", x => x.Id);
+                });
+
+            migrationBuilder.CreateTable(
+                name: "LoadingBalance",
+                columns: table => new
+                {
+                    Id = table.Column<long>(type: "bigint", nullable: false)
+                        .Annotation("SqlServer:Identity", "1, 1"),
+                    StationId = table.Column<int>(type: "int", nullable: false),
+                    MachineId = table.Column<string>(type: "nvarchar(36)", maxLength: 36, nullable: false),
+                    Power = table.Column<decimal>(type: "decimal(10,2)", nullable: false),
+                    CreatedOn = table.Column<DateTime>(type: "datetime", nullable: false),
+                    FinishedOn = table.Column<DateTime>(type: "datetime", nullable: false)
+                },
+                constraints: table =>
+                {
+                    table.PrimaryKey("PK_LoadingBalance", x => x.Id);
+                });
+
+            migrationBuilder.CreateTable(
+                name: "MachineConfigurations",
+                columns: table => new
+                {
+                    ConfigureName = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
+                    ChargeBoxId = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
+                    Id = table.Column<int>(type: "int", nullable: false)
+                        .Annotation("SqlServer:Identity", "1, 1"),
+                    ConfigureSetting = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: true),
+                    ReadOnly = table.Column<bool>(type: "bit", nullable: false),
+                    Exists = table.Column<bool>(type: "bit", nullable: false)
+                },
+                constraints: table =>
+                {
+                    table.PrimaryKey("PK_dbo.MachineConfigurations", x => new { x.ConfigureName, x.ChargeBoxId });
+                });
+
+            migrationBuilder.CreateTable(
+                name: "MachineError",
+                columns: table => new
+                {
+                    Id = table.Column<int>(type: "int", nullable: false)
+                        .Annotation("SqlServer:Identity", "1, 1"),
+                    ConnectorId = table.Column<byte>(type: "tinyint", nullable: false),
+                    PreStatus = table.Column<int>(type: "int", nullable: false),
+                    Status = table.Column<int>(type: "int", nullable: false),
+                    ErrorInfo = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
+                    VendorId = table.Column<string>(type: "nvarchar(255)", maxLength: 255, nullable: true),
+                    CreatedOn = table.Column<DateTime>(type: "datetime", nullable: false),
+                    ErrorCodeId = table.Column<int>(type: "int", nullable: false),
+                    VendorErrorCode = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
+                    ChargeBoxId = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true)
+                },
+                constraints: table =>
+                {
+                    table.PrimaryKey("PK_dbo.MachineError", x => x.Id);
+                });
+
+            migrationBuilder.CreateTable(
+                name: "MachineOperateRecord",
+                columns: table => new
+                {
+                    Id = table.Column<int>(type: "int", nullable: false)
+                        .Annotation("SqlServer:Identity", "1, 1"),
+                    SerialNo = table.Column<string>(type: "nvarchar(36)", maxLength: 36, nullable: true),
+                    RequestType = table.Column<int>(type: "int", nullable: false),
+                    RequestContent = table.Column<string>(type: "nvarchar(max)", nullable: true),
+                    Status = table.Column<int>(type: "int", nullable: false),
+                    CreatedOn = table.Column<DateTime>(type: "datetime", nullable: false),
+                    FinishedOn = table.Column<DateTime>(type: "datetime", nullable: false),
+                    EVSE_Value = table.Column<string>(type: "nvarchar(max)", nullable: true),
+                    EVSE_Status = table.Column<int>(type: "int", nullable: false),
+                    ChargeBoxId = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
+                    Action = table.Column<string>(type: "nvarchar(30)", maxLength: 30, nullable: true),
+                    ReportedOn = table.Column<DateTime>(type: "datetime", nullable: false)
+                },
+                constraints: table =>
+                {
+                    table.PrimaryKey("PK_dbo.MachineOperateRecord", x => x.Id);
+                });
+
+            migrationBuilder.CreateTable(
+                name: "OCMF",
+                columns: table => new
+                {
+                    Id = table.Column<int>(type: "int", nullable: false)
+                        .Annotation("SqlServer:Identity", "1, 1"),
+                    TransactionId = table.Column<int>(type: "int", nullable: false),
+                    DataString = table.Column<string>(type: "nvarchar(2048)", maxLength: 2048, nullable: true),
+                    PublicKey = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true)
+                },
+                constraints: table =>
+                {
+                    table.PrimaryKey("PK_dbo.OCMF", x => x.Id);
+                });
+
+            migrationBuilder.CreateTable(
+                name: "ServerMessage",
+                columns: table => new
+                {
+                    Id = table.Column<int>(type: "int", nullable: false)
+                        .Annotation("SqlServer:Identity", "1, 1"),
+                    SerialNo = table.Column<string>(type: "nvarchar(36)", maxLength: 36, nullable: true),
+                    OutAction = table.Column<string>(type: "nvarchar(30)", maxLength: 30, nullable: true),
+                    OutRequest = table.Column<string>(type: "nvarchar(max)", nullable: true),
+                    InMessage = table.Column<string>(type: "nvarchar(max)", nullable: true),
+                    CreatedOn = table.Column<DateTime>(type: "datetime", nullable: false),
+                    CreatedBy = table.Column<string>(type: "nvarchar(36)", maxLength: 36, nullable: true),
+                    ReceivedOn = table.Column<DateTime>(type: "datetime", nullable: false),
+                    ChargeBoxId = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
+                    UpdatedOn = table.Column<DateTime>(type: "datetime", nullable: false)
+                },
+                constraints: table =>
+                {
+                    table.PrimaryKey("PK_dbo.ServerMessage", x => x.Id);
+                });
+
+            migrationBuilder.CreateTable(
+                name: "TransactionRecord",
+                columns: table => new
+                {
+                    Id = table.Column<int>(type: "int", nullable: false)
+                        .Annotation("SqlServer:Identity", "1, 1"),
+                    StartTime = table.Column<DateTime>(type: "datetime", nullable: false),
+                    StopTime = table.Column<DateTime>(type: "datetime", nullable: false),
+                    CustomerId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
+                    ConnectorId = table.Column<byte>(type: "tinyint", nullable: false),
+                    MeterStart = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
+                    MeterStop = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
+                    CreatedOn = table.Column<DateTime>(type: "datetime", nullable: false),
+                    UpdatedOn = table.Column<DateTime>(type: "datetime", nullable: false),
+                    StartTransactionReportedOn = table.Column<DateTime>(type: "datetime", nullable: false),
+                    RetryStartTransactionTimes = table.Column<int>(type: "int", nullable: false),
+                    StopTransactionReportedOn = table.Column<DateTime>(type: "datetime", nullable: false),
+                    ErrorMsg = table.Column<string>(type: "nvarchar(max)", nullable: true),
+                    StartIdTag = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: true),
+                    StopIdTag = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: true),
+                    ReservationId = table.Column<int>(type: "int", nullable: false),
+                    StopReasonId = table.Column<int>(type: "int", nullable: false),
+                    ChargeBoxId = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
+                    RetryStopTransactionTimes = table.Column<int>(type: "int", nullable: false),
+                    UploadedtoTTIA = table.Column<bool>(type: "bit", nullable: false),
+                    Cost = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
+                    Fee = table.Column<string>(type: "nvarchar(1500)", maxLength: 1500, nullable: true),
+                    Receipt = table.Column<string>(type: "nvarchar(3000)", maxLength: 3000, nullable: true),
+                    BillingDone = table.Column<bool>(type: "bit", nullable: false),
+                    StopReason = table.Column<string>(type: "nvarchar(60)", maxLength: 60, nullable: true),
+                    StartSOC = table.Column<string>(type: "nvarchar(3)", maxLength: 3, nullable: true),
+                    StopSOC = table.Column<string>(type: "nvarchar(3)", maxLength: 3, nullable: true),
+                    NotifyPnC = table.Column<bool>(type: "bit", nullable: false),
+                    EVCCID = table.Column<string>(type: "nvarchar(30)", maxLength: 30, nullable: true)
+                },
+                constraints: table =>
+                {
+                    table.PrimaryKey("PK_dbo.TransactionRecord", x => x.Id);
+                });
+
+            migrationBuilder.CreateTable(
+                name: "UploadFile",
+                columns: table => new
+                {
+                    Id = table.Column<string>(type: "nvarchar(36)", maxLength: 36, nullable: false),
+                    FileName = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: false),
+                    OriginName = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: false),
+                    FileSize = table.Column<int>(type: "int", nullable: false),
+                    FileType = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: true),
+                    FileExtensionName = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
+                    FilePath = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: false),
+                    CreatedOn = table.Column<DateTime>(type: "datetime", nullable: false),
+                    CreatedBy = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
+                    FileMD5 = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
+                    FileUrl = table.Column<string>(type: "nvarchar(512)", maxLength: 512, nullable: true),
+                    VendorId = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
+                    ModelName = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
+                    ModuleId = table.Column<int>(type: "int", nullable: false)
+                },
+                constraints: table =>
+                {
+                    table.PrimaryKey("PK_dbo.UploadFile", x => x.Id);
+                });
+
+            migrationBuilder.CreateTable(
+                name: "Machine",
+                columns: table => new
+                {
+                    Id = table.Column<string>(type: "nvarchar(36)", maxLength: 36, nullable: false),
+                    ChargePointSerialNumber = table.Column<string>(type: "nvarchar(25)", maxLength: 25, nullable: true),
+                    ChargeBoxSerialNumber = table.Column<string>(type: "nvarchar(25)", maxLength: 25, nullable: true),
+                    ChargePointModel = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: true),
+                    ChargePointVendor = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: true),
+                    Iccid = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: true),
+                    Imsi = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: true),
+                    MeterType = table.Column<string>(type: "nvarchar(25)", maxLength: 25, nullable: true),
+                    MeterSerialNumber = table.Column<string>(type: "nvarchar(25)", maxLength: 25, nullable: true),
+                    CreatedOn = table.Column<DateTime>(type: "datetime", nullable: false),
+                    CreatedBy = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
+                    Comment = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
+                    CustomerId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
+                    GunAmt = table.Column<int>(type: "int", nullable: false),
+                    HeartbeatUpdatedOn = table.Column<DateTime>(type: "datetime", nullable: false),
+                    FW_VersionReport = table.Column<int>(type: "int", nullable: true),
+                    FW_AssignedVersion = table.Column<int>(type: "int", nullable: true),
+                    Online = table.Column<bool>(type: "bit", nullable: false),
+                    OfflineOn = table.Column<DateTime>(type: "datetime", nullable: true),
+                    FW_CurrentVersion = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
+                    ChargeBoxId = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
+                    ConnectionType = table.Column<int>(type: "int", nullable: false),
+                    RatedPower = table.Column<decimal>(type: "decimal(6,2)", nullable: false),
+                    ConnectorType = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
+                    ConnectorPowerType = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
+                    Latitude = table.Column<decimal>(type: "decimal(10,6)", nullable: false),
+                    Longitude = table.Column<decimal>(type: "decimal(10,6)", nullable: false),
+                    VendorId = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true, defaultValueSql: "('Zerova')"),
+                    ModelName = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false, defaultValueSql: "('')"),
+                    BoardVersions = table.Column<string>(type: "nvarchar(max)", nullable: true),
+                    IsDelete = table.Column<bool>(type: "bit", nullable: false),
+                    TTIATag = table.Column<int>(type: "int", nullable: false)
+                },
+                constraints: table =>
+                {
+                    table.PrimaryKey("PK_dbo.Machine", x => x.Id);
+                    table.ForeignKey(
+                        name: "FK_dbo.Machine_dbo.Customer_CustomerId",
+                        column: x => x.CustomerId,
+                        principalTable: "Customer",
+                        principalColumn: "Id",
+                        onDelete: ReferentialAction.Cascade);
+                });
+
+            migrationBuilder.CreateTable(
+                name: "MachineVersionFile",
+                columns: table => new
+                {
+                    Id = table.Column<int>(type: "int", nullable: false)
+                        .Annotation("SqlServer:Identity", "1, 1"),
+                    CreatedOn = table.Column<DateTime>(type: "datetime", nullable: false),
+                    UploadFileId = table.Column<string>(type: "nvarchar(36)", maxLength: 36, nullable: false),
+                    Seq = table.Column<int>(type: "int", nullable: false),
+                    ChargeBoxId = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true)
+                },
+                constraints: table =>
+                {
+                    table.PrimaryKey("PK_dbo.MachineVersionFile", x => x.Id);
+                    table.ForeignKey(
+                        name: "FK_dbo.MachineVersionFile_dbo.UploadFile_UploadFileId",
+                        column: x => x.UploadFileId,
+                        principalTable: "UploadFile",
+                        principalColumn: "Id",
+                        onDelete: ReferentialAction.Cascade);
+                });
+
+            migrationBuilder.CreateIndex(
+                name: "IX_ConnectorStatus",
+                table: "ConnectorStatus",
+                columns: new[] { "ChargeBoxId", "ConnectorId" },
+                unique: true,
+                filter: "[ChargeBoxId] IS NOT NULL");
+
+            migrationBuilder.CreateIndex(
+                name: "nci_wi_Machine_7CD4A9D1688F96F6967B2244A0666F62",
+                table: "Machine",
+                columns: new[] { "CustomerId", "ChargeBoxId" });
+
+            migrationBuilder.CreateIndex(
+                name: "nci_wi_MachineConfigurations_132E765C043BF95A2570D2EA019DD783",
+                table: "MachineConfigurations",
+                columns: new[] { "ConfigureName", "ConfigureSetting" });
+
+            migrationBuilder.CreateIndex(
+                name: "IX_MachineVersionFile_UploadFileId",
+                table: "MachineVersionFile",
+                column: "UploadFileId");
+
+            migrationBuilder.CreateIndex(
+                name: "nci_wi_ServerMessage_EC00C205420F6CB01974705B93F9507F",
+                table: "ServerMessage",
+                columns: new[] { "ReceivedOn", "UpdatedOn", "CreatedOn" });
+
+            migrationBuilder.CreateIndex(
+                name: "IX_TransactionRecord_StartTime",
+                table: "TransactionRecord",
+                columns: new[] { "CustomerId", "ConnectorId", "StartTime", "ChargeBoxId" });
+
+            migrationBuilder.CreateIndex(
+                name: "nci_wi_TransactionRecord_92D4DF08E7034102014AC91760F890FE",
+                table: "TransactionRecord",
+                columns: new[] { "CustomerId", "StopTransactionReportedOn", "StopTime" });
+        }
+
+        /// <inheritdoc />
+        protected override void Down(MigrationBuilder migrationBuilder)
+        {
+            migrationBuilder.DropTable(
+                name: "__MigrationHistory");
+
+            migrationBuilder.DropTable(
+                name: "ConnectorMeterValueRecord");
+
+            migrationBuilder.DropTable(
+                name: "ConnectorStatus");
+
+            migrationBuilder.DropTable(
+                name: "LoadingBalance");
+
+            migrationBuilder.DropTable(
+                name: "Machine");
+
+            migrationBuilder.DropTable(
+                name: "MachineConfigurations");
+
+            migrationBuilder.DropTable(
+                name: "MachineError");
+
+            migrationBuilder.DropTable(
+                name: "MachineOperateRecord");
+
+            migrationBuilder.DropTable(
+                name: "MachineVersionFile");
+
+            migrationBuilder.DropTable(
+                name: "OCMF");
+
+            migrationBuilder.DropTable(
+                name: "ServerMessage");
+
+            migrationBuilder.DropTable(
+                name: "TransactionRecord");
+
+            migrationBuilder.DropTable(
+                name: "Customer");
+
+            migrationBuilder.DropTable(
+                name: "UploadFile");
+        }
+    }
+}

+ 1077 - 0
EVCB_OCPP.Domain/Migrations/20231019090745_Updatetest.Designer.cs

@@ -0,0 +1,1077 @@
+// <auto-generated />
+using System;
+using EVCB_OCPP.Domain;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Metadata;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+
+#nullable disable
+
+namespace EVCB_OCPP.Domain.Migrations
+{
+    [DbContext(typeof(MainDBContext))]
+    [Migration("20231019090745_Updatetest")]
+    partial class Updatetest
+    {
+        /// <inheritdoc />
+        protected override void BuildTargetModel(ModelBuilder modelBuilder)
+        {
+#pragma warning disable 612, 618
+            modelBuilder
+                .UseCollation("Chinese_Taiwan_Stroke_CI_AS")
+                .HasAnnotation("ProductVersion", "7.0.12")
+                .HasAnnotation("Relational:MaxIdentifierLength", 128);
+
+            SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
+
+            modelBuilder.Entity("EVCB_OCPP.Domain.Models.MainDb.ConnectorMeterValueRecord", b =>
+                {
+                    b.Property<long>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("bigint");
+
+                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"));
+
+                    b.Property<string>("ChargeBoxId")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<byte>("ConnectorId")
+                        .HasColumnType("tinyint");
+
+                    b.Property<int>("ContextId")
+                        .HasColumnType("int");
+
+                    b.Property<DateTime>("CreatedOn")
+                        .HasColumnType("datetime");
+
+                    b.Property<int>("FormatId")
+                        .HasColumnType("int");
+
+                    b.Property<int>("LocationId")
+                        .HasColumnType("int");
+
+                    b.Property<int>("MeasurandId")
+                        .HasColumnType("int");
+
+                    b.Property<int>("PhaseId")
+                        .HasColumnType("int");
+
+                    b.Property<int>("TransactionId")
+                        .HasColumnType("int");
+
+                    b.Property<int>("UnitId")
+                        .HasColumnType("int");
+
+                    b.Property<string>("Value")
+                        .HasMaxLength(10)
+                        .HasColumnType("nvarchar(10)");
+
+                    b.HasKey("Id")
+                        .HasName("PK_dbo.ConnectorMeterValueRecord");
+
+                    b.ToTable("ConnectorMeterValueRecord", (string)null);
+                });
+
+            modelBuilder.Entity("EVCB_OCPP.Domain.Models.MainDb.ConnectorStatus", b =>
+                {
+                    b.Property<string>("Id")
+                        .HasMaxLength(36)
+                        .HasColumnType("nvarchar(36)");
+
+                    b.Property<string>("ChargeBoxId")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<int>("ChargePointErrorCodeId")
+                        .HasColumnType("int");
+
+                    b.Property<byte>("ConnectorId")
+                        .HasColumnType("tinyint");
+
+                    b.Property<DateTime>("CreatedOn")
+                        .HasColumnType("datetime");
+
+                    b.Property<string>("ErrorInfo")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<int>("Status")
+                        .HasColumnType("int");
+
+                    b.Property<decimal>("TotalEnergy")
+                        .HasColumnType("decimal(10, 2)");
+
+                    b.Property<int>("Type")
+                        .HasColumnType("int");
+
+                    b.Property<string>("VendorErrorCode")
+                        .HasMaxLength(100)
+                        .HasColumnType("nvarchar(100)");
+
+                    b.Property<string>("VendorId")
+                        .HasMaxLength(255)
+                        .HasColumnType("nvarchar(255)");
+
+                    b.HasKey("Id")
+                        .HasName("PK_dbo.ConnectorStatus");
+
+                    b.HasIndex(new[] { "ChargeBoxId", "ConnectorId" }, "IX_ConnectorStatus")
+                        .IsUnique()
+                        .HasFilter("[ChargeBoxId] IS NOT NULL");
+
+                    b.ToTable("ConnectorStatus", (string)null);
+                });
+
+            modelBuilder.Entity("EVCB_OCPP.Domain.Models.MainDb.Customer", b =>
+                {
+                    b.Property<Guid>("Id")
+                        .HasColumnType("uniqueidentifier");
+
+                    b.Property<string>("ApiCustomerId")
+                        .HasMaxLength(36)
+                        .HasColumnType("nvarchar(36)");
+
+                    b.Property<string>("ApiKey")
+                        .HasMaxLength(128)
+                        .HasColumnType("nvarchar(128)");
+
+                    b.Property<DateTime?>("ApiKeyUpdatedOn")
+                        .HasColumnType("datetime");
+
+                    b.Property<string>("ApiUrl")
+                        .HasMaxLength(256)
+                        .HasColumnType("nvarchar(256)");
+
+                    b.Property<bool>("CallPartnerApiOnSchedule")
+                        .HasColumnType("bit");
+
+                    b.Property<string>("CreatedBy")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<DateTime>("CreatedOn")
+                        .HasColumnType("datetime");
+
+                    b.Property<DateTime?>("Deadline")
+                        .HasColumnType("datetime");
+
+                    b.Property<bool>("EnableTtia")
+                        .HasColumnType("bit")
+                        .HasColumnName("EnableTTIA");
+
+                    b.Property<string>("Ftphost")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)")
+                        .HasColumnName("FTPHost");
+
+                    b.Property<string>("Ftppassword")
+                        .HasMaxLength(20)
+                        .HasColumnType("nvarchar(20)")
+                        .HasColumnName("FTPPassword");
+
+                    b.Property<string>("Ftppath")
+                        .HasColumnType("nvarchar(max)")
+                        .HasColumnName("FTPPath");
+
+                    b.Property<string>("Ftpuser")
+                        .HasMaxLength(20)
+                        .HasColumnType("nvarchar(20)")
+                        .HasColumnName("FTPUser");
+
+                    b.Property<bool>("InstantStopTxReport")
+                        .HasColumnType("bit");
+
+                    b.Property<bool>("IsShow")
+                        .HasColumnType("bit");
+
+                    b.Property<string>("Name")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<string>("PartnerId")
+                        .HasMaxLength(36)
+                        .HasColumnType("nvarchar(36)");
+
+                    b.Property<string>("TtiaApikey")
+                        .HasMaxLength(10)
+                        .HasColumnType("nvarchar(10)")
+                        .HasColumnName("TTIA_APIKey");
+
+                    b.Property<string>("TtiaApiurl")
+                        .HasMaxLength(100)
+                        .HasColumnType("nvarchar(100)")
+                        .HasColumnName("TTIA_APIUrl");
+
+                    b.Property<int>("TtiaCustomerId")
+                        .HasColumnType("int")
+                        .HasColumnName("TTIA_CustomerId");
+
+                    b.Property<string>("TtiaEquipmentProvider")
+                        .HasMaxLength(10)
+                        .HasColumnType("nvarchar(10)")
+                        .HasColumnName("TTIA_EquipmentProvider");
+
+                    b.Property<string>("UpdatedBy")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<DateTime?>("UpdatedOn")
+                        .HasColumnType("datetime");
+
+                    b.HasKey("Id")
+                        .HasName("PK_dbo.Customer");
+
+                    b.ToTable("Customer", (string)null);
+                });
+
+            modelBuilder.Entity("EVCB_OCPP.Domain.Models.MainDb.LoadingBalance", b =>
+                {
+                    b.Property<long>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("bigint");
+
+                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"));
+
+                    b.Property<DateTime>("CreatedOn")
+                        .HasColumnType("datetime");
+
+                    b.Property<DateTime>("FinishedOn")
+                        .HasColumnType("datetime");
+
+                    b.Property<string>("MachineId")
+                        .IsRequired()
+                        .HasMaxLength(36)
+                        .HasColumnType("nvarchar(36)");
+
+                    b.Property<decimal>("Power")
+                        .HasColumnType("decimal(10, 2)");
+
+                    b.Property<int>("StationId")
+                        .HasColumnType("int");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("LoadingBalance", (string)null);
+                });
+
+            modelBuilder.Entity("EVCB_OCPP.Domain.Models.MainDb.Machine", b =>
+                {
+                    b.Property<string>("Id")
+                        .HasMaxLength(36)
+                        .HasColumnType("nvarchar(36)");
+
+                    b.Property<string>("BoardVersions")
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("ChargeBoxId")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<string>("ChargeBoxSerialNumber")
+                        .HasMaxLength(25)
+                        .HasColumnType("nvarchar(25)");
+
+                    b.Property<string>("ChargePointModel")
+                        .HasMaxLength(20)
+                        .HasColumnType("nvarchar(20)");
+
+                    b.Property<string>("ChargePointSerialNumber")
+                        .HasMaxLength(25)
+                        .HasColumnType("nvarchar(25)");
+
+                    b.Property<string>("ChargePointVendor")
+                        .HasMaxLength(20)
+                        .HasColumnType("nvarchar(20)");
+
+                    b.Property<string>("Comment")
+                        .HasMaxLength(100)
+                        .HasColumnType("nvarchar(100)");
+
+                    b.Property<int>("ConnectionType")
+                        .HasColumnType("int");
+
+                    b.Property<string>("ConnectorPowerType")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<string>("ConnectorType")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<string>("CreatedBy")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<DateTime>("CreatedOn")
+                        .HasColumnType("datetime");
+
+                    b.Property<Guid>("CustomerId")
+                        .HasColumnType("uniqueidentifier");
+
+                    b.Property<int?>("FwAssignedVersion")
+                        .HasColumnType("int")
+                        .HasColumnName("FW_AssignedVersion");
+
+                    b.Property<string>("FwCurrentVersion")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)")
+                        .HasColumnName("FW_CurrentVersion");
+
+                    b.Property<int?>("FwVersionReport")
+                        .HasColumnType("int")
+                        .HasColumnName("FW_VersionReport");
+
+                    b.Property<int>("GunAmt")
+                        .HasColumnType("int");
+
+                    b.Property<DateTime>("HeartbeatUpdatedOn")
+                        .HasColumnType("datetime");
+
+                    b.Property<string>("Iccid")
+                        .HasMaxLength(20)
+                        .HasColumnType("nvarchar(20)");
+
+                    b.Property<string>("Imsi")
+                        .HasMaxLength(20)
+                        .HasColumnType("nvarchar(20)");
+
+                    b.Property<bool>("IsDelete")
+                        .HasColumnType("bit");
+
+                    b.Property<decimal>("Latitude")
+                        .HasColumnType("decimal(10, 6)");
+
+                    b.Property<decimal>("Longitude")
+                        .HasColumnType("decimal(10, 6)");
+
+                    b.Property<string>("MeterSerialNumber")
+                        .HasMaxLength(25)
+                        .HasColumnType("nvarchar(25)");
+
+                    b.Property<string>("MeterType")
+                        .HasMaxLength(25)
+                        .HasColumnType("nvarchar(25)");
+
+                    b.Property<string>("ModelName")
+                        .IsRequired()
+                        .ValueGeneratedOnAdd()
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)")
+                        .HasDefaultValueSql("('')");
+
+                    b.Property<string>("Name")
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<DateTime?>("OfflineOn")
+                        .HasColumnType("datetime");
+
+                    b.Property<bool>("Online")
+                        .HasColumnType("bit");
+
+                    b.Property<decimal>("RatedPower")
+                        .HasColumnType("decimal(6, 2)");
+
+                    b.Property<int>("Ttiatag")
+                        .HasColumnType("int")
+                        .HasColumnName("TTIATag");
+
+                    b.Property<string>("VendorId")
+                        .ValueGeneratedOnAdd()
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)")
+                        .HasDefaultValueSql("('Zerova')");
+
+                    b.HasKey("Id")
+                        .HasName("PK_dbo.Machine");
+
+                    b.HasIndex(new[] { "CustomerId", "ChargeBoxId" }, "nci_wi_Machine_7CD4A9D1688F96F6967B2244A0666F62");
+
+                    b.ToTable("Machine", (string)null);
+                });
+
+            modelBuilder.Entity("EVCB_OCPP.Domain.Models.MainDb.MachineConfiguration", b =>
+                {
+                    b.Property<string>("ConfigureName")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<string>("ChargeBoxId")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<string>("ConfigureSetting")
+                        .HasMaxLength(500)
+                        .HasColumnType("nvarchar(500)");
+
+                    b.Property<bool>("Exists")
+                        .HasColumnType("bit");
+
+                    b.Property<int>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("int");
+
+                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
+
+                    b.Property<bool>("ReadOnly")
+                        .HasColumnType("bit");
+
+                    b.HasKey("ConfigureName", "ChargeBoxId")
+                        .HasName("PK_dbo.MachineConfigurations");
+
+                    b.HasIndex(new[] { "ConfigureName", "ConfigureSetting" }, "nci_wi_MachineConfigurations_132E765C043BF95A2570D2EA019DD783");
+
+                    b.ToTable("MachineConfigurations");
+                });
+
+            modelBuilder.Entity("EVCB_OCPP.Domain.Models.MainDb.MachineError", b =>
+                {
+                    b.Property<int>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("int");
+
+                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
+
+                    b.Property<string>("ChargeBoxId")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<byte>("ConnectorId")
+                        .HasColumnType("tinyint");
+
+                    b.Property<DateTime>("CreatedOn")
+                        .HasColumnType("datetime");
+
+                    b.Property<int>("ErrorCodeId")
+                        .HasColumnType("int");
+
+                    b.Property<string>("ErrorInfo")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<int>("PreStatus")
+                        .HasColumnType("int");
+
+                    b.Property<int>("Status")
+                        .HasColumnType("int");
+
+                    b.Property<string>("VendorErrorCode")
+                        .HasMaxLength(100)
+                        .HasColumnType("nvarchar(100)");
+
+                    b.Property<string>("VendorId")
+                        .HasMaxLength(255)
+                        .HasColumnType("nvarchar(255)");
+
+                    b.HasKey("Id")
+                        .HasName("PK_dbo.MachineError");
+
+                    b.ToTable("MachineError", (string)null);
+                });
+
+            modelBuilder.Entity("EVCB_OCPP.Domain.Models.MainDb.MachineOperateRecord", b =>
+                {
+                    b.Property<int>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("int");
+
+                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
+
+                    b.Property<string>("Action")
+                        .HasMaxLength(30)
+                        .HasColumnType("nvarchar(30)");
+
+                    b.Property<string>("ChargeBoxId")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<DateTime>("CreatedOn")
+                        .HasColumnType("datetime");
+
+                    b.Property<int>("EvseStatus")
+                        .HasColumnType("int")
+                        .HasColumnName("EVSE_Status");
+
+                    b.Property<string>("EvseValue")
+                        .HasColumnType("nvarchar(max)")
+                        .HasColumnName("EVSE_Value");
+
+                    b.Property<DateTime>("FinishedOn")
+                        .HasColumnType("datetime");
+
+                    b.Property<DateTime>("ReportedOn")
+                        .HasColumnType("datetime");
+
+                    b.Property<string>("RequestContent")
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<int>("RequestType")
+                        .HasColumnType("int");
+
+                    b.Property<string>("SerialNo")
+                        .HasMaxLength(36)
+                        .HasColumnType("nvarchar(36)");
+
+                    b.Property<int>("Status")
+                        .HasColumnType("int");
+
+                    b.HasKey("Id")
+                        .HasName("PK_dbo.MachineOperateRecord");
+
+                    b.ToTable("MachineOperateRecord", (string)null);
+                });
+
+            modelBuilder.Entity("EVCB_OCPP.Domain.Models.MainDb.MachineVersionFile", b =>
+                {
+                    b.Property<int>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("int");
+
+                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
+
+                    b.Property<string>("ChargeBoxId")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<DateTime>("CreatedOn")
+                        .HasColumnType("datetime");
+
+                    b.Property<int>("Seq")
+                        .HasColumnType("int");
+
+                    b.Property<string>("UploadFileId")
+                        .IsRequired()
+                        .HasMaxLength(36)
+                        .HasColumnType("nvarchar(36)");
+
+                    b.HasKey("Id")
+                        .HasName("PK_dbo.MachineVersionFile");
+
+                    b.HasIndex("UploadFileId");
+
+                    b.ToTable("MachineVersionFile", (string)null);
+                });
+
+            modelBuilder.Entity("EVCB_OCPP.Domain.Models.MainDb.MigrationHistory", b =>
+                {
+                    b.Property<string>("MigrationId")
+                        .HasMaxLength(150)
+                        .HasColumnType("nvarchar(150)");
+
+                    b.Property<string>("ContextKey")
+                        .HasMaxLength(300)
+                        .HasColumnType("nvarchar(300)");
+
+                    b.Property<byte[]>("Model")
+                        .IsRequired()
+                        .HasColumnType("varbinary(max)");
+
+                    b.Property<string>("ProductVersion")
+                        .IsRequired()
+                        .HasMaxLength(32)
+                        .HasColumnType("nvarchar(32)");
+
+                    b.HasKey("MigrationId", "ContextKey")
+                        .HasName("PK_dbo.__MigrationHistory");
+
+                    b.ToTable("__MigrationHistory", (string)null);
+                });
+
+            modelBuilder.Entity("EVCB_OCPP.Domain.Models.MainDb.Ocmf", b =>
+                {
+                    b.Property<int>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("int");
+
+                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
+
+                    b.Property<string>("DataString")
+                        .HasMaxLength(2048)
+                        .HasColumnType("nvarchar(2048)");
+
+                    b.Property<string>("PublicKey")
+                        .HasMaxLength(256)
+                        .HasColumnType("nvarchar(256)");
+
+                    b.Property<int>("TransactionId")
+                        .HasColumnType("int");
+
+                    b.HasKey("Id")
+                        .HasName("PK_dbo.OCMF");
+
+                    b.ToTable("OCMF", (string)null);
+                });
+
+            modelBuilder.Entity("EVCB_OCPP.Domain.Models.MainDb.ServerMessage", b =>
+                {
+                    b.Property<int>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("int");
+
+                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
+
+                    b.Property<string>("ChargeBoxId")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<string>("CreatedBy")
+                        .HasMaxLength(36)
+                        .HasColumnType("nvarchar(36)");
+
+                    b.Property<DateTime>("CreatedOn")
+                        .HasColumnType("datetime");
+
+                    b.Property<string>("InMessage")
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("OutAction")
+                        .HasMaxLength(30)
+                        .HasColumnType("nvarchar(30)");
+
+                    b.Property<string>("OutRequest")
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<DateTime>("ReceivedOn")
+                        .HasColumnType("datetime");
+
+                    b.Property<string>("SerialNo")
+                        .HasMaxLength(36)
+                        .HasColumnType("nvarchar(36)");
+
+                    b.Property<DateTime>("UpdatedOn")
+                        .HasColumnType("datetime");
+
+                    b.HasKey("Id")
+                        .HasName("PK_dbo.ServerMessage");
+
+                    b.HasIndex(new[] { "ReceivedOn", "UpdatedOn", "CreatedOn" }, "nci_wi_ServerMessage_EC00C205420F6CB01974705B93F9507F");
+
+                    b.ToTable("ServerMessage", (string)null);
+                });
+
+            modelBuilder.Entity("EVCB_OCPP.Domain.Models.MainDb.TransactionRecord", b =>
+                {
+                    b.Property<int>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("int");
+
+                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
+
+                    b.Property<bool>("BillingDone")
+                        .HasColumnType("bit");
+
+                    b.Property<string>("ChargeBoxId")
+                        .IsRequired()
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<byte>("ConnectorId")
+                        .HasColumnType("tinyint");
+
+                    b.Property<decimal>("Cost")
+                        .HasColumnType("decimal(18, 2)");
+
+                    b.Property<DateTime>("CreatedOn")
+                        .HasColumnType("datetime");
+
+                    b.Property<Guid>("CustomerId")
+                        .HasColumnType("uniqueidentifier");
+
+                    b.Property<string>("ErrorMsg")
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("Evccid")
+                        .HasMaxLength(30)
+                        .HasColumnType("nvarchar(30)")
+                        .HasColumnName("EVCCID");
+
+                    b.Property<string>("Fee")
+                        .HasMaxLength(1500)
+                        .HasColumnType("nvarchar(1500)");
+
+                    b.Property<decimal>("MeterStart")
+                        .HasColumnType("decimal(18, 2)");
+
+                    b.Property<decimal>("MeterStop")
+                        .HasColumnType("decimal(18, 2)");
+
+                    b.Property<bool>("NotifyPnC")
+                        .HasColumnType("bit");
+
+                    b.Property<string>("Receipt")
+                        .HasMaxLength(3000)
+                        .HasColumnType("nvarchar(3000)");
+
+                    b.Property<int>("ReservationId")
+                        .HasColumnType("int");
+
+                    b.Property<int>("RetryStartTransactionTimes")
+                        .HasColumnType("int");
+
+                    b.Property<int>("RetryStopTransactionTimes")
+                        .HasColumnType("int");
+
+                    b.Property<string>("StartIdTag")
+                        .HasMaxLength(20)
+                        .HasColumnType("nvarchar(20)");
+
+                    b.Property<string>("StartSoc")
+                        .HasMaxLength(3)
+                        .HasColumnType("nvarchar(3)")
+                        .HasColumnName("StartSOC");
+
+                    b.Property<DateTime>("StartTime")
+                        .HasColumnType("datetime");
+
+                    b.Property<DateTime>("StartTransactionReportedOn")
+                        .HasColumnType("datetime");
+
+                    b.Property<string>("StopIdTag")
+                        .HasMaxLength(20)
+                        .HasColumnType("nvarchar(20)");
+
+                    b.Property<string>("StopReason")
+                        .HasMaxLength(60)
+                        .HasColumnType("nvarchar(60)");
+
+                    b.Property<int>("StopReasonId")
+                        .HasColumnType("int");
+
+                    b.Property<string>("StopSoc")
+                        .HasMaxLength(3)
+                        .HasColumnType("nvarchar(3)")
+                        .HasColumnName("StopSOC");
+
+                    b.Property<DateTime>("StopTime")
+                        .HasColumnType("datetime");
+
+                    b.Property<DateTime>("StopTransactionReportedOn")
+                        .HasColumnType("datetime");
+
+                    b.Property<DateTime>("UpdatedOn")
+                        .HasColumnType("datetime");
+
+                    b.Property<bool>("UploadedtoTtia")
+                        .HasColumnType("bit")
+                        .HasColumnName("UploadedtoTTIA");
+
+                    b.HasKey("Id")
+                        .HasName("PK_dbo.TransactionRecord");
+
+                    b.HasIndex(new[] { "CustomerId", "ConnectorId", "StartTime", "ChargeBoxId" }, "IX_TransactionRecord_StartTime");
+
+                    b.HasIndex(new[] { "CustomerId", "StopTransactionReportedOn", "StopTime" }, "nci_wi_TransactionRecord_92D4DF08E7034102014AC91760F890FE");
+
+                    b.ToTable("TransactionRecord", (string)null);
+                });
+
+            modelBuilder.Entity("EVCB_OCPP.Domain.Models.MainDb.UploadFile", b =>
+                {
+                    b.Property<string>("Id")
+                        .HasMaxLength(36)
+                        .HasColumnType("nvarchar(36)");
+
+                    b.Property<string>("CreatedBy")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<DateTime>("CreatedOn")
+                        .HasColumnType("datetime");
+
+                    b.Property<string>("FileExtensionName")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<string>("FileMd5")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)")
+                        .HasColumnName("FileMD5");
+
+                    b.Property<string>("FileName")
+                        .IsRequired()
+                        .HasMaxLength(500)
+                        .HasColumnType("nvarchar(500)");
+
+                    b.Property<string>("FilePath")
+                        .IsRequired()
+                        .HasMaxLength(500)
+                        .HasColumnType("nvarchar(500)");
+
+                    b.Property<int>("FileSize")
+                        .HasColumnType("int");
+
+                    b.Property<string>("FileType")
+                        .HasMaxLength(200)
+                        .HasColumnType("nvarchar(200)");
+
+                    b.Property<string>("FileUrl")
+                        .HasMaxLength(512)
+                        .HasColumnType("nvarchar(512)");
+
+                    b.Property<string>("ModelName")
+                        .IsRequired()
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<int>("ModuleId")
+                        .HasColumnType("int");
+
+                    b.Property<string>("OriginName")
+                        .IsRequired()
+                        .HasMaxLength(500)
+                        .HasColumnType("nvarchar(500)");
+
+                    b.Property<string>("VendorId")
+                        .IsRequired()
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.HasKey("Id")
+                        .HasName("PK_dbo.UploadFile");
+
+                    b.ToTable("UploadFile", (string)null);
+                });
+
+            modelBuilder.Entity("EVCB_OCPP.Domain.Models.MainDb.VConnectorStatus", b =>
+                {
+                    b.Property<string>("ChargeBoxId")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<int>("ChargePointErrorCodeId")
+                        .HasColumnType("int");
+
+                    b.Property<byte>("ConnectorId")
+                        .HasColumnType("tinyint");
+
+                    b.Property<DateTime>("CreatedOn")
+                        .HasColumnType("datetime");
+
+                    b.Property<string>("ErrorInfo")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<string>("Id")
+                        .IsRequired()
+                        .HasMaxLength(36)
+                        .HasColumnType("nvarchar(36)");
+
+                    b.Property<int>("Status")
+                        .HasColumnType("int");
+
+                    b.Property<decimal>("TotalEnergy")
+                        .HasColumnType("decimal(10, 2)");
+
+                    b.Property<int>("Type")
+                        .HasColumnType("int");
+
+                    b.Property<string>("VendorErrorCode")
+                        .HasMaxLength(100)
+                        .HasColumnType("nvarchar(100)");
+
+                    b.Property<string>("VendorId")
+                        .HasMaxLength(255)
+                        .HasColumnType("nvarchar(255)");
+
+                    b.ToTable((string)null);
+
+                    b.ToView("vConnectorStatus", (string)null);
+                });
+
+            modelBuilder.Entity("EVCB_OCPP.Domain.Models.MainDb.VConnectorStatusCombind", b =>
+                {
+                    b.Property<string>("ChargeBoxId")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<int>("ChargePointErrorCodeId")
+                        .HasColumnType("int");
+
+                    b.Property<byte>("ConnectorId")
+                        .HasColumnType("tinyint");
+
+                    b.Property<string>("Ocpp")
+                        .IsRequired()
+                        .HasMaxLength(3)
+                        .IsUnicode(false)
+                        .HasColumnType("varchar(3)")
+                        .HasColumnName("OCPP");
+
+                    b.Property<int>("Status")
+                        .HasColumnType("int");
+
+                    b.Property<decimal>("TotalEnergy")
+                        .HasColumnType("decimal(10, 2)");
+
+                    b.Property<int>("Type")
+                        .HasColumnType("int");
+
+                    b.Property<string>("VendorErrorCode")
+                        .HasMaxLength(100)
+                        .HasColumnType("nvarchar(100)");
+
+                    b.ToTable((string)null);
+
+                    b.ToView("vConnectorStatusCombind", (string)null);
+                });
+
+            modelBuilder.Entity("EVCB_OCPP.Domain.Models.MainDb.VMachine", b =>
+                {
+                    b.Property<string>("ChargeBoxId")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<int>("ConnectionType")
+                        .HasColumnType("int");
+
+                    b.Property<string>("ConnectorType")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<Guid>("CustomerId")
+                        .HasColumnType("uniqueidentifier");
+
+                    b.Property<int>("GunAmt")
+                        .HasColumnType("int");
+
+                    b.Property<DateTime>("HeartbeatUpdatedOn")
+                        .HasColumnType("datetime");
+
+                    b.Property<string>("Id")
+                        .IsRequired()
+                        .HasMaxLength(36)
+                        .HasColumnType("nvarchar(36)");
+
+                    b.Property<bool>("IsDelete")
+                        .HasColumnType("bit");
+
+                    b.Property<string>("ModelName")
+                        .IsRequired()
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<DateTime?>("OfflineOn")
+                        .HasColumnType("datetime");
+
+                    b.Property<bool>("Online")
+                        .HasColumnType("bit");
+
+                    b.Property<decimal>("RatedPower")
+                        .HasColumnType("decimal(6, 2)");
+
+                    b.Property<int>("Ttiatag")
+                        .HasColumnType("int")
+                        .HasColumnName("TTIATag");
+
+                    b.Property<string>("VendorId")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.ToTable((string)null);
+
+                    b.ToView("vMachine", (string)null);
+                });
+
+            modelBuilder.Entity("EVCB_OCPP.Domain.Models.MainDb.VMachineCombind", b =>
+                {
+                    b.Property<string>("ChargeBoxId")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<int>("ConnectionType")
+                        .HasColumnType("int");
+
+                    b.Property<string>("ConnectorType")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<Guid>("CustomerId")
+                        .HasColumnType("uniqueidentifier");
+
+                    b.Property<int>("GunAmt")
+                        .HasColumnType("int");
+
+                    b.Property<DateTime>("HeartbeatUpdatedOn")
+                        .HasColumnType("datetime");
+
+                    b.Property<string>("Id")
+                        .IsRequired()
+                        .HasMaxLength(36)
+                        .HasColumnType("nvarchar(36)");
+
+                    b.Property<bool>("IsDelete")
+                        .HasColumnType("bit");
+
+                    b.Property<string>("ModelName")
+                        .IsRequired()
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<string>("Ocpp")
+                        .IsRequired()
+                        .HasMaxLength(3)
+                        .IsUnicode(false)
+                        .HasColumnType("varchar(3)")
+                        .HasColumnName("OCPP");
+
+                    b.Property<DateTime?>("OfflineOn")
+                        .HasColumnType("datetime");
+
+                    b.Property<bool>("Online")
+                        .HasColumnType("bit");
+
+                    b.Property<decimal>("RatedPower")
+                        .HasColumnType("decimal(6, 2)");
+
+                    b.Property<int>("Ttiatag")
+                        .HasColumnType("int")
+                        .HasColumnName("TTIATag");
+
+                    b.Property<string>("VendorId")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.ToTable((string)null);
+
+                    b.ToView("vMachineCombind", (string)null);
+                });
+
+            modelBuilder.Entity("EVCB_OCPP.Domain.Models.MainDb.Machine", b =>
+                {
+                    b.HasOne("EVCB_OCPP.Domain.Models.MainDb.Customer", "Customer")
+                        .WithMany("Machines")
+                        .HasForeignKey("CustomerId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired()
+                        .HasConstraintName("FK_dbo.Machine_dbo.Customer_CustomerId");
+
+                    b.Navigation("Customer");
+                });
+
+            modelBuilder.Entity("EVCB_OCPP.Domain.Models.MainDb.MachineVersionFile", b =>
+                {
+                    b.HasOne("EVCB_OCPP.Domain.Models.MainDb.UploadFile", "UploadFile")
+                        .WithMany("MachineVersionFiles")
+                        .HasForeignKey("UploadFileId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired()
+                        .HasConstraintName("FK_dbo.MachineVersionFile_dbo.UploadFile_UploadFileId");
+
+                    b.Navigation("UploadFile");
+                });
+
+            modelBuilder.Entity("EVCB_OCPP.Domain.Models.MainDb.Customer", b =>
+                {
+                    b.Navigation("Machines");
+                });
+
+            modelBuilder.Entity("EVCB_OCPP.Domain.Models.MainDb.UploadFile", b =>
+                {
+                    b.Navigation("MachineVersionFiles");
+                });
+#pragma warning restore 612, 618
+        }
+    }
+}

+ 28 - 0
EVCB_OCPP.Domain/Migrations/20231019090745_Updatetest.cs

@@ -0,0 +1,28 @@
+using Microsoft.EntityFrameworkCore.Migrations;
+
+#nullable disable
+
+namespace EVCB_OCPP.Domain.Migrations
+{
+    /// <inheritdoc />
+    public partial class Updatetest : Migration
+    {
+        /// <inheritdoc />
+        protected override void Up(MigrationBuilder migrationBuilder)
+        {
+            migrationBuilder.AddColumn<string>(
+                name: "Name",
+                table: "Machine",
+                type: "nvarchar(max)",
+                nullable: true);
+        }
+
+        /// <inheritdoc />
+        protected override void Down(MigrationBuilder migrationBuilder)
+        {
+            migrationBuilder.DropColumn(
+                name: "Name",
+                table: "Machine");
+        }
+    }
+}

+ 1074 - 0
EVCB_OCPP.Domain/Migrations/20231019090908_RemoveUpdatetest.Designer.cs

@@ -0,0 +1,1074 @@
+// <auto-generated />
+using System;
+using EVCB_OCPP.Domain;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Metadata;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+
+#nullable disable
+
+namespace EVCB_OCPP.Domain.Migrations
+{
+    [DbContext(typeof(MainDBContext))]
+    [Migration("20231019090908_RemoveUpdatetest")]
+    partial class RemoveUpdatetest
+    {
+        /// <inheritdoc />
+        protected override void BuildTargetModel(ModelBuilder modelBuilder)
+        {
+#pragma warning disable 612, 618
+            modelBuilder
+                .UseCollation("Chinese_Taiwan_Stroke_CI_AS")
+                .HasAnnotation("ProductVersion", "7.0.12")
+                .HasAnnotation("Relational:MaxIdentifierLength", 128);
+
+            SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
+
+            modelBuilder.Entity("EVCB_OCPP.Domain.Models.MainDb.ConnectorMeterValueRecord", b =>
+                {
+                    b.Property<long>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("bigint");
+
+                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"));
+
+                    b.Property<string>("ChargeBoxId")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<byte>("ConnectorId")
+                        .HasColumnType("tinyint");
+
+                    b.Property<int>("ContextId")
+                        .HasColumnType("int");
+
+                    b.Property<DateTime>("CreatedOn")
+                        .HasColumnType("datetime");
+
+                    b.Property<int>("FormatId")
+                        .HasColumnType("int");
+
+                    b.Property<int>("LocationId")
+                        .HasColumnType("int");
+
+                    b.Property<int>("MeasurandId")
+                        .HasColumnType("int");
+
+                    b.Property<int>("PhaseId")
+                        .HasColumnType("int");
+
+                    b.Property<int>("TransactionId")
+                        .HasColumnType("int");
+
+                    b.Property<int>("UnitId")
+                        .HasColumnType("int");
+
+                    b.Property<string>("Value")
+                        .HasMaxLength(10)
+                        .HasColumnType("nvarchar(10)");
+
+                    b.HasKey("Id")
+                        .HasName("PK_dbo.ConnectorMeterValueRecord");
+
+                    b.ToTable("ConnectorMeterValueRecord", (string)null);
+                });
+
+            modelBuilder.Entity("EVCB_OCPP.Domain.Models.MainDb.ConnectorStatus", b =>
+                {
+                    b.Property<string>("Id")
+                        .HasMaxLength(36)
+                        .HasColumnType("nvarchar(36)");
+
+                    b.Property<string>("ChargeBoxId")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<int>("ChargePointErrorCodeId")
+                        .HasColumnType("int");
+
+                    b.Property<byte>("ConnectorId")
+                        .HasColumnType("tinyint");
+
+                    b.Property<DateTime>("CreatedOn")
+                        .HasColumnType("datetime");
+
+                    b.Property<string>("ErrorInfo")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<int>("Status")
+                        .HasColumnType("int");
+
+                    b.Property<decimal>("TotalEnergy")
+                        .HasColumnType("decimal(10, 2)");
+
+                    b.Property<int>("Type")
+                        .HasColumnType("int");
+
+                    b.Property<string>("VendorErrorCode")
+                        .HasMaxLength(100)
+                        .HasColumnType("nvarchar(100)");
+
+                    b.Property<string>("VendorId")
+                        .HasMaxLength(255)
+                        .HasColumnType("nvarchar(255)");
+
+                    b.HasKey("Id")
+                        .HasName("PK_dbo.ConnectorStatus");
+
+                    b.HasIndex(new[] { "ChargeBoxId", "ConnectorId" }, "IX_ConnectorStatus")
+                        .IsUnique()
+                        .HasFilter("[ChargeBoxId] IS NOT NULL");
+
+                    b.ToTable("ConnectorStatus", (string)null);
+                });
+
+            modelBuilder.Entity("EVCB_OCPP.Domain.Models.MainDb.Customer", b =>
+                {
+                    b.Property<Guid>("Id")
+                        .HasColumnType("uniqueidentifier");
+
+                    b.Property<string>("ApiCustomerId")
+                        .HasMaxLength(36)
+                        .HasColumnType("nvarchar(36)");
+
+                    b.Property<string>("ApiKey")
+                        .HasMaxLength(128)
+                        .HasColumnType("nvarchar(128)");
+
+                    b.Property<DateTime?>("ApiKeyUpdatedOn")
+                        .HasColumnType("datetime");
+
+                    b.Property<string>("ApiUrl")
+                        .HasMaxLength(256)
+                        .HasColumnType("nvarchar(256)");
+
+                    b.Property<bool>("CallPartnerApiOnSchedule")
+                        .HasColumnType("bit");
+
+                    b.Property<string>("CreatedBy")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<DateTime>("CreatedOn")
+                        .HasColumnType("datetime");
+
+                    b.Property<DateTime?>("Deadline")
+                        .HasColumnType("datetime");
+
+                    b.Property<bool>("EnableTtia")
+                        .HasColumnType("bit")
+                        .HasColumnName("EnableTTIA");
+
+                    b.Property<string>("Ftphost")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)")
+                        .HasColumnName("FTPHost");
+
+                    b.Property<string>("Ftppassword")
+                        .HasMaxLength(20)
+                        .HasColumnType("nvarchar(20)")
+                        .HasColumnName("FTPPassword");
+
+                    b.Property<string>("Ftppath")
+                        .HasColumnType("nvarchar(max)")
+                        .HasColumnName("FTPPath");
+
+                    b.Property<string>("Ftpuser")
+                        .HasMaxLength(20)
+                        .HasColumnType("nvarchar(20)")
+                        .HasColumnName("FTPUser");
+
+                    b.Property<bool>("InstantStopTxReport")
+                        .HasColumnType("bit");
+
+                    b.Property<bool>("IsShow")
+                        .HasColumnType("bit");
+
+                    b.Property<string>("Name")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<string>("PartnerId")
+                        .HasMaxLength(36)
+                        .HasColumnType("nvarchar(36)");
+
+                    b.Property<string>("TtiaApikey")
+                        .HasMaxLength(10)
+                        .HasColumnType("nvarchar(10)")
+                        .HasColumnName("TTIA_APIKey");
+
+                    b.Property<string>("TtiaApiurl")
+                        .HasMaxLength(100)
+                        .HasColumnType("nvarchar(100)")
+                        .HasColumnName("TTIA_APIUrl");
+
+                    b.Property<int>("TtiaCustomerId")
+                        .HasColumnType("int")
+                        .HasColumnName("TTIA_CustomerId");
+
+                    b.Property<string>("TtiaEquipmentProvider")
+                        .HasMaxLength(10)
+                        .HasColumnType("nvarchar(10)")
+                        .HasColumnName("TTIA_EquipmentProvider");
+
+                    b.Property<string>("UpdatedBy")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<DateTime?>("UpdatedOn")
+                        .HasColumnType("datetime");
+
+                    b.HasKey("Id")
+                        .HasName("PK_dbo.Customer");
+
+                    b.ToTable("Customer", (string)null);
+                });
+
+            modelBuilder.Entity("EVCB_OCPP.Domain.Models.MainDb.LoadingBalance", b =>
+                {
+                    b.Property<long>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("bigint");
+
+                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"));
+
+                    b.Property<DateTime>("CreatedOn")
+                        .HasColumnType("datetime");
+
+                    b.Property<DateTime>("FinishedOn")
+                        .HasColumnType("datetime");
+
+                    b.Property<string>("MachineId")
+                        .IsRequired()
+                        .HasMaxLength(36)
+                        .HasColumnType("nvarchar(36)");
+
+                    b.Property<decimal>("Power")
+                        .HasColumnType("decimal(10, 2)");
+
+                    b.Property<int>("StationId")
+                        .HasColumnType("int");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("LoadingBalance", (string)null);
+                });
+
+            modelBuilder.Entity("EVCB_OCPP.Domain.Models.MainDb.Machine", b =>
+                {
+                    b.Property<string>("Id")
+                        .HasMaxLength(36)
+                        .HasColumnType("nvarchar(36)");
+
+                    b.Property<string>("BoardVersions")
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("ChargeBoxId")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<string>("ChargeBoxSerialNumber")
+                        .HasMaxLength(25)
+                        .HasColumnType("nvarchar(25)");
+
+                    b.Property<string>("ChargePointModel")
+                        .HasMaxLength(20)
+                        .HasColumnType("nvarchar(20)");
+
+                    b.Property<string>("ChargePointSerialNumber")
+                        .HasMaxLength(25)
+                        .HasColumnType("nvarchar(25)");
+
+                    b.Property<string>("ChargePointVendor")
+                        .HasMaxLength(20)
+                        .HasColumnType("nvarchar(20)");
+
+                    b.Property<string>("Comment")
+                        .HasMaxLength(100)
+                        .HasColumnType("nvarchar(100)");
+
+                    b.Property<int>("ConnectionType")
+                        .HasColumnType("int");
+
+                    b.Property<string>("ConnectorPowerType")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<string>("ConnectorType")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<string>("CreatedBy")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<DateTime>("CreatedOn")
+                        .HasColumnType("datetime");
+
+                    b.Property<Guid>("CustomerId")
+                        .HasColumnType("uniqueidentifier");
+
+                    b.Property<int?>("FwAssignedVersion")
+                        .HasColumnType("int")
+                        .HasColumnName("FW_AssignedVersion");
+
+                    b.Property<string>("FwCurrentVersion")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)")
+                        .HasColumnName("FW_CurrentVersion");
+
+                    b.Property<int?>("FwVersionReport")
+                        .HasColumnType("int")
+                        .HasColumnName("FW_VersionReport");
+
+                    b.Property<int>("GunAmt")
+                        .HasColumnType("int");
+
+                    b.Property<DateTime>("HeartbeatUpdatedOn")
+                        .HasColumnType("datetime");
+
+                    b.Property<string>("Iccid")
+                        .HasMaxLength(20)
+                        .HasColumnType("nvarchar(20)");
+
+                    b.Property<string>("Imsi")
+                        .HasMaxLength(20)
+                        .HasColumnType("nvarchar(20)");
+
+                    b.Property<bool>("IsDelete")
+                        .HasColumnType("bit");
+
+                    b.Property<decimal>("Latitude")
+                        .HasColumnType("decimal(10, 6)");
+
+                    b.Property<decimal>("Longitude")
+                        .HasColumnType("decimal(10, 6)");
+
+                    b.Property<string>("MeterSerialNumber")
+                        .HasMaxLength(25)
+                        .HasColumnType("nvarchar(25)");
+
+                    b.Property<string>("MeterType")
+                        .HasMaxLength(25)
+                        .HasColumnType("nvarchar(25)");
+
+                    b.Property<string>("ModelName")
+                        .IsRequired()
+                        .ValueGeneratedOnAdd()
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)")
+                        .HasDefaultValueSql("('')");
+
+                    b.Property<DateTime?>("OfflineOn")
+                        .HasColumnType("datetime");
+
+                    b.Property<bool>("Online")
+                        .HasColumnType("bit");
+
+                    b.Property<decimal>("RatedPower")
+                        .HasColumnType("decimal(6, 2)");
+
+                    b.Property<int>("Ttiatag")
+                        .HasColumnType("int")
+                        .HasColumnName("TTIATag");
+
+                    b.Property<string>("VendorId")
+                        .ValueGeneratedOnAdd()
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)")
+                        .HasDefaultValueSql("('Zerova')");
+
+                    b.HasKey("Id")
+                        .HasName("PK_dbo.Machine");
+
+                    b.HasIndex(new[] { "CustomerId", "ChargeBoxId" }, "nci_wi_Machine_7CD4A9D1688F96F6967B2244A0666F62");
+
+                    b.ToTable("Machine", (string)null);
+                });
+
+            modelBuilder.Entity("EVCB_OCPP.Domain.Models.MainDb.MachineConfiguration", b =>
+                {
+                    b.Property<string>("ConfigureName")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<string>("ChargeBoxId")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<string>("ConfigureSetting")
+                        .HasMaxLength(500)
+                        .HasColumnType("nvarchar(500)");
+
+                    b.Property<bool>("Exists")
+                        .HasColumnType("bit");
+
+                    b.Property<int>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("int");
+
+                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
+
+                    b.Property<bool>("ReadOnly")
+                        .HasColumnType("bit");
+
+                    b.HasKey("ConfigureName", "ChargeBoxId")
+                        .HasName("PK_dbo.MachineConfigurations");
+
+                    b.HasIndex(new[] { "ConfigureName", "ConfigureSetting" }, "nci_wi_MachineConfigurations_132E765C043BF95A2570D2EA019DD783");
+
+                    b.ToTable("MachineConfigurations");
+                });
+
+            modelBuilder.Entity("EVCB_OCPP.Domain.Models.MainDb.MachineError", b =>
+                {
+                    b.Property<int>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("int");
+
+                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
+
+                    b.Property<string>("ChargeBoxId")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<byte>("ConnectorId")
+                        .HasColumnType("tinyint");
+
+                    b.Property<DateTime>("CreatedOn")
+                        .HasColumnType("datetime");
+
+                    b.Property<int>("ErrorCodeId")
+                        .HasColumnType("int");
+
+                    b.Property<string>("ErrorInfo")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<int>("PreStatus")
+                        .HasColumnType("int");
+
+                    b.Property<int>("Status")
+                        .HasColumnType("int");
+
+                    b.Property<string>("VendorErrorCode")
+                        .HasMaxLength(100)
+                        .HasColumnType("nvarchar(100)");
+
+                    b.Property<string>("VendorId")
+                        .HasMaxLength(255)
+                        .HasColumnType("nvarchar(255)");
+
+                    b.HasKey("Id")
+                        .HasName("PK_dbo.MachineError");
+
+                    b.ToTable("MachineError", (string)null);
+                });
+
+            modelBuilder.Entity("EVCB_OCPP.Domain.Models.MainDb.MachineOperateRecord", b =>
+                {
+                    b.Property<int>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("int");
+
+                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
+
+                    b.Property<string>("Action")
+                        .HasMaxLength(30)
+                        .HasColumnType("nvarchar(30)");
+
+                    b.Property<string>("ChargeBoxId")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<DateTime>("CreatedOn")
+                        .HasColumnType("datetime");
+
+                    b.Property<int>("EvseStatus")
+                        .HasColumnType("int")
+                        .HasColumnName("EVSE_Status");
+
+                    b.Property<string>("EvseValue")
+                        .HasColumnType("nvarchar(max)")
+                        .HasColumnName("EVSE_Value");
+
+                    b.Property<DateTime>("FinishedOn")
+                        .HasColumnType("datetime");
+
+                    b.Property<DateTime>("ReportedOn")
+                        .HasColumnType("datetime");
+
+                    b.Property<string>("RequestContent")
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<int>("RequestType")
+                        .HasColumnType("int");
+
+                    b.Property<string>("SerialNo")
+                        .HasMaxLength(36)
+                        .HasColumnType("nvarchar(36)");
+
+                    b.Property<int>("Status")
+                        .HasColumnType("int");
+
+                    b.HasKey("Id")
+                        .HasName("PK_dbo.MachineOperateRecord");
+
+                    b.ToTable("MachineOperateRecord", (string)null);
+                });
+
+            modelBuilder.Entity("EVCB_OCPP.Domain.Models.MainDb.MachineVersionFile", b =>
+                {
+                    b.Property<int>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("int");
+
+                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
+
+                    b.Property<string>("ChargeBoxId")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<DateTime>("CreatedOn")
+                        .HasColumnType("datetime");
+
+                    b.Property<int>("Seq")
+                        .HasColumnType("int");
+
+                    b.Property<string>("UploadFileId")
+                        .IsRequired()
+                        .HasMaxLength(36)
+                        .HasColumnType("nvarchar(36)");
+
+                    b.HasKey("Id")
+                        .HasName("PK_dbo.MachineVersionFile");
+
+                    b.HasIndex("UploadFileId");
+
+                    b.ToTable("MachineVersionFile", (string)null);
+                });
+
+            modelBuilder.Entity("EVCB_OCPP.Domain.Models.MainDb.MigrationHistory", b =>
+                {
+                    b.Property<string>("MigrationId")
+                        .HasMaxLength(150)
+                        .HasColumnType("nvarchar(150)");
+
+                    b.Property<string>("ContextKey")
+                        .HasMaxLength(300)
+                        .HasColumnType("nvarchar(300)");
+
+                    b.Property<byte[]>("Model")
+                        .IsRequired()
+                        .HasColumnType("varbinary(max)");
+
+                    b.Property<string>("ProductVersion")
+                        .IsRequired()
+                        .HasMaxLength(32)
+                        .HasColumnType("nvarchar(32)");
+
+                    b.HasKey("MigrationId", "ContextKey")
+                        .HasName("PK_dbo.__MigrationHistory");
+
+                    b.ToTable("__MigrationHistory", (string)null);
+                });
+
+            modelBuilder.Entity("EVCB_OCPP.Domain.Models.MainDb.Ocmf", b =>
+                {
+                    b.Property<int>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("int");
+
+                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
+
+                    b.Property<string>("DataString")
+                        .HasMaxLength(2048)
+                        .HasColumnType("nvarchar(2048)");
+
+                    b.Property<string>("PublicKey")
+                        .HasMaxLength(256)
+                        .HasColumnType("nvarchar(256)");
+
+                    b.Property<int>("TransactionId")
+                        .HasColumnType("int");
+
+                    b.HasKey("Id")
+                        .HasName("PK_dbo.OCMF");
+
+                    b.ToTable("OCMF", (string)null);
+                });
+
+            modelBuilder.Entity("EVCB_OCPP.Domain.Models.MainDb.ServerMessage", b =>
+                {
+                    b.Property<int>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("int");
+
+                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
+
+                    b.Property<string>("ChargeBoxId")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<string>("CreatedBy")
+                        .HasMaxLength(36)
+                        .HasColumnType("nvarchar(36)");
+
+                    b.Property<DateTime>("CreatedOn")
+                        .HasColumnType("datetime");
+
+                    b.Property<string>("InMessage")
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("OutAction")
+                        .HasMaxLength(30)
+                        .HasColumnType("nvarchar(30)");
+
+                    b.Property<string>("OutRequest")
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<DateTime>("ReceivedOn")
+                        .HasColumnType("datetime");
+
+                    b.Property<string>("SerialNo")
+                        .HasMaxLength(36)
+                        .HasColumnType("nvarchar(36)");
+
+                    b.Property<DateTime>("UpdatedOn")
+                        .HasColumnType("datetime");
+
+                    b.HasKey("Id")
+                        .HasName("PK_dbo.ServerMessage");
+
+                    b.HasIndex(new[] { "ReceivedOn", "UpdatedOn", "CreatedOn" }, "nci_wi_ServerMessage_EC00C205420F6CB01974705B93F9507F");
+
+                    b.ToTable("ServerMessage", (string)null);
+                });
+
+            modelBuilder.Entity("EVCB_OCPP.Domain.Models.MainDb.TransactionRecord", b =>
+                {
+                    b.Property<int>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("int");
+
+                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
+
+                    b.Property<bool>("BillingDone")
+                        .HasColumnType("bit");
+
+                    b.Property<string>("ChargeBoxId")
+                        .IsRequired()
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<byte>("ConnectorId")
+                        .HasColumnType("tinyint");
+
+                    b.Property<decimal>("Cost")
+                        .HasColumnType("decimal(18, 2)");
+
+                    b.Property<DateTime>("CreatedOn")
+                        .HasColumnType("datetime");
+
+                    b.Property<Guid>("CustomerId")
+                        .HasColumnType("uniqueidentifier");
+
+                    b.Property<string>("ErrorMsg")
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("Evccid")
+                        .HasMaxLength(30)
+                        .HasColumnType("nvarchar(30)")
+                        .HasColumnName("EVCCID");
+
+                    b.Property<string>("Fee")
+                        .HasMaxLength(1500)
+                        .HasColumnType("nvarchar(1500)");
+
+                    b.Property<decimal>("MeterStart")
+                        .HasColumnType("decimal(18, 2)");
+
+                    b.Property<decimal>("MeterStop")
+                        .HasColumnType("decimal(18, 2)");
+
+                    b.Property<bool>("NotifyPnC")
+                        .HasColumnType("bit");
+
+                    b.Property<string>("Receipt")
+                        .HasMaxLength(3000)
+                        .HasColumnType("nvarchar(3000)");
+
+                    b.Property<int>("ReservationId")
+                        .HasColumnType("int");
+
+                    b.Property<int>("RetryStartTransactionTimes")
+                        .HasColumnType("int");
+
+                    b.Property<int>("RetryStopTransactionTimes")
+                        .HasColumnType("int");
+
+                    b.Property<string>("StartIdTag")
+                        .HasMaxLength(20)
+                        .HasColumnType("nvarchar(20)");
+
+                    b.Property<string>("StartSoc")
+                        .HasMaxLength(3)
+                        .HasColumnType("nvarchar(3)")
+                        .HasColumnName("StartSOC");
+
+                    b.Property<DateTime>("StartTime")
+                        .HasColumnType("datetime");
+
+                    b.Property<DateTime>("StartTransactionReportedOn")
+                        .HasColumnType("datetime");
+
+                    b.Property<string>("StopIdTag")
+                        .HasMaxLength(20)
+                        .HasColumnType("nvarchar(20)");
+
+                    b.Property<string>("StopReason")
+                        .HasMaxLength(60)
+                        .HasColumnType("nvarchar(60)");
+
+                    b.Property<int>("StopReasonId")
+                        .HasColumnType("int");
+
+                    b.Property<string>("StopSoc")
+                        .HasMaxLength(3)
+                        .HasColumnType("nvarchar(3)")
+                        .HasColumnName("StopSOC");
+
+                    b.Property<DateTime>("StopTime")
+                        .HasColumnType("datetime");
+
+                    b.Property<DateTime>("StopTransactionReportedOn")
+                        .HasColumnType("datetime");
+
+                    b.Property<DateTime>("UpdatedOn")
+                        .HasColumnType("datetime");
+
+                    b.Property<bool>("UploadedtoTtia")
+                        .HasColumnType("bit")
+                        .HasColumnName("UploadedtoTTIA");
+
+                    b.HasKey("Id")
+                        .HasName("PK_dbo.TransactionRecord");
+
+                    b.HasIndex(new[] { "CustomerId", "ConnectorId", "StartTime", "ChargeBoxId" }, "IX_TransactionRecord_StartTime");
+
+                    b.HasIndex(new[] { "CustomerId", "StopTransactionReportedOn", "StopTime" }, "nci_wi_TransactionRecord_92D4DF08E7034102014AC91760F890FE");
+
+                    b.ToTable("TransactionRecord", (string)null);
+                });
+
+            modelBuilder.Entity("EVCB_OCPP.Domain.Models.MainDb.UploadFile", b =>
+                {
+                    b.Property<string>("Id")
+                        .HasMaxLength(36)
+                        .HasColumnType("nvarchar(36)");
+
+                    b.Property<string>("CreatedBy")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<DateTime>("CreatedOn")
+                        .HasColumnType("datetime");
+
+                    b.Property<string>("FileExtensionName")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<string>("FileMd5")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)")
+                        .HasColumnName("FileMD5");
+
+                    b.Property<string>("FileName")
+                        .IsRequired()
+                        .HasMaxLength(500)
+                        .HasColumnType("nvarchar(500)");
+
+                    b.Property<string>("FilePath")
+                        .IsRequired()
+                        .HasMaxLength(500)
+                        .HasColumnType("nvarchar(500)");
+
+                    b.Property<int>("FileSize")
+                        .HasColumnType("int");
+
+                    b.Property<string>("FileType")
+                        .HasMaxLength(200)
+                        .HasColumnType("nvarchar(200)");
+
+                    b.Property<string>("FileUrl")
+                        .HasMaxLength(512)
+                        .HasColumnType("nvarchar(512)");
+
+                    b.Property<string>("ModelName")
+                        .IsRequired()
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<int>("ModuleId")
+                        .HasColumnType("int");
+
+                    b.Property<string>("OriginName")
+                        .IsRequired()
+                        .HasMaxLength(500)
+                        .HasColumnType("nvarchar(500)");
+
+                    b.Property<string>("VendorId")
+                        .IsRequired()
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.HasKey("Id")
+                        .HasName("PK_dbo.UploadFile");
+
+                    b.ToTable("UploadFile", (string)null);
+                });
+
+            modelBuilder.Entity("EVCB_OCPP.Domain.Models.MainDb.VConnectorStatus", b =>
+                {
+                    b.Property<string>("ChargeBoxId")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<int>("ChargePointErrorCodeId")
+                        .HasColumnType("int");
+
+                    b.Property<byte>("ConnectorId")
+                        .HasColumnType("tinyint");
+
+                    b.Property<DateTime>("CreatedOn")
+                        .HasColumnType("datetime");
+
+                    b.Property<string>("ErrorInfo")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<string>("Id")
+                        .IsRequired()
+                        .HasMaxLength(36)
+                        .HasColumnType("nvarchar(36)");
+
+                    b.Property<int>("Status")
+                        .HasColumnType("int");
+
+                    b.Property<decimal>("TotalEnergy")
+                        .HasColumnType("decimal(10, 2)");
+
+                    b.Property<int>("Type")
+                        .HasColumnType("int");
+
+                    b.Property<string>("VendorErrorCode")
+                        .HasMaxLength(100)
+                        .HasColumnType("nvarchar(100)");
+
+                    b.Property<string>("VendorId")
+                        .HasMaxLength(255)
+                        .HasColumnType("nvarchar(255)");
+
+                    b.ToTable((string)null);
+
+                    b.ToView("vConnectorStatus", (string)null);
+                });
+
+            modelBuilder.Entity("EVCB_OCPP.Domain.Models.MainDb.VConnectorStatusCombind", b =>
+                {
+                    b.Property<string>("ChargeBoxId")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<int>("ChargePointErrorCodeId")
+                        .HasColumnType("int");
+
+                    b.Property<byte>("ConnectorId")
+                        .HasColumnType("tinyint");
+
+                    b.Property<string>("Ocpp")
+                        .IsRequired()
+                        .HasMaxLength(3)
+                        .IsUnicode(false)
+                        .HasColumnType("varchar(3)")
+                        .HasColumnName("OCPP");
+
+                    b.Property<int>("Status")
+                        .HasColumnType("int");
+
+                    b.Property<decimal>("TotalEnergy")
+                        .HasColumnType("decimal(10, 2)");
+
+                    b.Property<int>("Type")
+                        .HasColumnType("int");
+
+                    b.Property<string>("VendorErrorCode")
+                        .HasMaxLength(100)
+                        .HasColumnType("nvarchar(100)");
+
+                    b.ToTable((string)null);
+
+                    b.ToView("vConnectorStatusCombind", (string)null);
+                });
+
+            modelBuilder.Entity("EVCB_OCPP.Domain.Models.MainDb.VMachine", b =>
+                {
+                    b.Property<string>("ChargeBoxId")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<int>("ConnectionType")
+                        .HasColumnType("int");
+
+                    b.Property<string>("ConnectorType")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<Guid>("CustomerId")
+                        .HasColumnType("uniqueidentifier");
+
+                    b.Property<int>("GunAmt")
+                        .HasColumnType("int");
+
+                    b.Property<DateTime>("HeartbeatUpdatedOn")
+                        .HasColumnType("datetime");
+
+                    b.Property<string>("Id")
+                        .IsRequired()
+                        .HasMaxLength(36)
+                        .HasColumnType("nvarchar(36)");
+
+                    b.Property<bool>("IsDelete")
+                        .HasColumnType("bit");
+
+                    b.Property<string>("ModelName")
+                        .IsRequired()
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<DateTime?>("OfflineOn")
+                        .HasColumnType("datetime");
+
+                    b.Property<bool>("Online")
+                        .HasColumnType("bit");
+
+                    b.Property<decimal>("RatedPower")
+                        .HasColumnType("decimal(6, 2)");
+
+                    b.Property<int>("Ttiatag")
+                        .HasColumnType("int")
+                        .HasColumnName("TTIATag");
+
+                    b.Property<string>("VendorId")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.ToTable((string)null);
+
+                    b.ToView("vMachine", (string)null);
+                });
+
+            modelBuilder.Entity("EVCB_OCPP.Domain.Models.MainDb.VMachineCombind", b =>
+                {
+                    b.Property<string>("ChargeBoxId")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<int>("ConnectionType")
+                        .HasColumnType("int");
+
+                    b.Property<string>("ConnectorType")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<Guid>("CustomerId")
+                        .HasColumnType("uniqueidentifier");
+
+                    b.Property<int>("GunAmt")
+                        .HasColumnType("int");
+
+                    b.Property<DateTime>("HeartbeatUpdatedOn")
+                        .HasColumnType("datetime");
+
+                    b.Property<string>("Id")
+                        .IsRequired()
+                        .HasMaxLength(36)
+                        .HasColumnType("nvarchar(36)");
+
+                    b.Property<bool>("IsDelete")
+                        .HasColumnType("bit");
+
+                    b.Property<string>("ModelName")
+                        .IsRequired()
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<string>("Ocpp")
+                        .IsRequired()
+                        .HasMaxLength(3)
+                        .IsUnicode(false)
+                        .HasColumnType("varchar(3)")
+                        .HasColumnName("OCPP");
+
+                    b.Property<DateTime?>("OfflineOn")
+                        .HasColumnType("datetime");
+
+                    b.Property<bool>("Online")
+                        .HasColumnType("bit");
+
+                    b.Property<decimal>("RatedPower")
+                        .HasColumnType("decimal(6, 2)");
+
+                    b.Property<int>("Ttiatag")
+                        .HasColumnType("int")
+                        .HasColumnName("TTIATag");
+
+                    b.Property<string>("VendorId")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.ToTable((string)null);
+
+                    b.ToView("vMachineCombind", (string)null);
+                });
+
+            modelBuilder.Entity("EVCB_OCPP.Domain.Models.MainDb.Machine", b =>
+                {
+                    b.HasOne("EVCB_OCPP.Domain.Models.MainDb.Customer", "Customer")
+                        .WithMany("Machines")
+                        .HasForeignKey("CustomerId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired()
+                        .HasConstraintName("FK_dbo.Machine_dbo.Customer_CustomerId");
+
+                    b.Navigation("Customer");
+                });
+
+            modelBuilder.Entity("EVCB_OCPP.Domain.Models.MainDb.MachineVersionFile", b =>
+                {
+                    b.HasOne("EVCB_OCPP.Domain.Models.MainDb.UploadFile", "UploadFile")
+                        .WithMany("MachineVersionFiles")
+                        .HasForeignKey("UploadFileId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired()
+                        .HasConstraintName("FK_dbo.MachineVersionFile_dbo.UploadFile_UploadFileId");
+
+                    b.Navigation("UploadFile");
+                });
+
+            modelBuilder.Entity("EVCB_OCPP.Domain.Models.MainDb.Customer", b =>
+                {
+                    b.Navigation("Machines");
+                });
+
+            modelBuilder.Entity("EVCB_OCPP.Domain.Models.MainDb.UploadFile", b =>
+                {
+                    b.Navigation("MachineVersionFiles");
+                });
+#pragma warning restore 612, 618
+        }
+    }
+}

+ 28 - 0
EVCB_OCPP.Domain/Migrations/20231019090908_RemoveUpdatetest.cs

@@ -0,0 +1,28 @@
+using Microsoft.EntityFrameworkCore.Migrations;
+
+#nullable disable
+
+namespace EVCB_OCPP.Domain.Migrations
+{
+    /// <inheritdoc />
+    public partial class RemoveUpdatetest : Migration
+    {
+        /// <inheritdoc />
+        protected override void Up(MigrationBuilder migrationBuilder)
+        {
+            migrationBuilder.DropColumn(
+                name: "Name",
+                table: "Machine");
+        }
+
+        /// <inheritdoc />
+        protected override void Down(MigrationBuilder migrationBuilder)
+        {
+            migrationBuilder.AddColumn<string>(
+                name: "Name",
+                table: "Machine",
+                type: "nvarchar(max)",
+                nullable: true);
+        }
+    }
+}

+ 75 - 0
EVCB_OCPP.Domain/Migrations/ConnectionLogDB/20231019091533_InitialCreate.Designer.cs

@@ -0,0 +1,75 @@
+// <auto-generated />
+using System;
+using EVCB_OCPP.Domain;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Metadata;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+
+#nullable disable
+
+namespace EVCB_OCPP.Domain.Migrations.ConnectionLogDB
+{
+    [DbContext(typeof(ConnectionLogDBContext))]
+    [Migration("20231019091533_InitialCreate")]
+    partial class InitialCreate
+    {
+        /// <inheritdoc />
+        protected override void BuildTargetModel(ModelBuilder modelBuilder)
+        {
+#pragma warning disable 612, 618
+            modelBuilder
+                .UseCollation("Chinese_Taiwan_Stroke_CI_AS")
+                .HasAnnotation("ProductVersion", "7.0.12")
+                .HasAnnotation("Relational:MaxIdentifierLength", 128);
+
+            SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
+
+            modelBuilder.Entity("EVCB_OCPP.Domain.Models.ConnectionLogDB.MachineConnectionLog", b =>
+                {
+                    b.Property<long>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("bigint");
+
+                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"));
+
+                    b.Property<DateTime>("CreatedOn")
+                        .HasColumnType("datetime");
+
+                    b.Property<string>("ChargeBoxId")
+                        .HasMaxLength(128)
+                        .HasColumnType("nvarchar(128)");
+
+                    b.Property<string>("Data")
+                        .HasMaxLength(3600)
+                        .HasColumnType("nvarchar(3600)");
+
+                    b.Property<string>("EvseendPoint")
+                        .HasMaxLength(25)
+                        .HasColumnType("nvarchar(25)")
+                        .HasColumnName("EVSEEndPoint");
+
+                    b.Property<bool>("IsSent")
+                        .HasColumnType("bit");
+
+                    b.Property<string>("MessageType")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<string>("Msg")
+                        .HasMaxLength(200)
+                        .HasColumnType("nvarchar(200)");
+
+                    b.Property<string>("Session")
+                        .HasMaxLength(36)
+                        .HasColumnType("nvarchar(36)");
+
+                    b.HasKey("Id", "CreatedOn");
+
+                    b.ToTable("MachineConnectionLog", (string)null);
+                });
+#pragma warning restore 612, 618
+        }
+    }
+}

+ 42 - 0
EVCB_OCPP.Domain/Migrations/ConnectionLogDB/20231019091533_InitialCreate.cs

@@ -0,0 +1,42 @@
+using System;
+using Microsoft.EntityFrameworkCore.Migrations;
+
+#nullable disable
+
+namespace EVCB_OCPP.Domain.Migrations.ConnectionLogDB
+{
+    /// <inheritdoc />
+    public partial class InitialCreate : Migration
+    {
+        /// <inheritdoc />
+        protected override void Up(MigrationBuilder migrationBuilder)
+        {
+            migrationBuilder.CreateTable(
+                name: "MachineConnectionLog",
+                columns: table => new
+                {
+                    Id = table.Column<long>(type: "bigint", nullable: false)
+                        .Annotation("SqlServer:Identity", "1, 1"),
+                    CreatedOn = table.Column<DateTime>(type: "datetime", nullable: false),
+                    MessageType = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
+                    Data = table.Column<string>(type: "nvarchar(3600)", maxLength: 3600, nullable: true),
+                    Msg = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: true),
+                    ChargeBoxId = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: true),
+                    IsSent = table.Column<bool>(type: "bit", nullable: false),
+                    EVSEEndPoint = table.Column<string>(type: "nvarchar(25)", maxLength: 25, nullable: true),
+                    Session = table.Column<string>(type: "nvarchar(36)", maxLength: 36, nullable: true)
+                },
+                constraints: table =>
+                {
+                    table.PrimaryKey("PK_MachineConnectionLog", x => new { x.Id, x.CreatedOn });
+                });
+        }
+
+        /// <inheritdoc />
+        protected override void Down(MigrationBuilder migrationBuilder)
+        {
+            migrationBuilder.DropTable(
+                name: "MachineConnectionLog");
+        }
+    }
+}

+ 72 - 0
EVCB_OCPP.Domain/Migrations/ConnectionLogDB/ConnectionLogDBContextModelSnapshot.cs

@@ -0,0 +1,72 @@
+// <auto-generated />
+using System;
+using EVCB_OCPP.Domain;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Metadata;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+
+#nullable disable
+
+namespace EVCB_OCPP.Domain.Migrations.ConnectionLogDB
+{
+    [DbContext(typeof(ConnectionLogDBContext))]
+    partial class ConnectionLogDBContextModelSnapshot : ModelSnapshot
+    {
+        protected override void BuildModel(ModelBuilder modelBuilder)
+        {
+#pragma warning disable 612, 618
+            modelBuilder
+                .UseCollation("Chinese_Taiwan_Stroke_CI_AS")
+                .HasAnnotation("ProductVersion", "7.0.12")
+                .HasAnnotation("Relational:MaxIdentifierLength", 128);
+
+            SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
+
+            modelBuilder.Entity("EVCB_OCPP.Domain.Models.ConnectionLogDB.MachineConnectionLog", b =>
+                {
+                    b.Property<long>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("bigint");
+
+                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"));
+
+                    b.Property<DateTime>("CreatedOn")
+                        .HasColumnType("datetime");
+
+                    b.Property<string>("ChargeBoxId")
+                        .HasMaxLength(128)
+                        .HasColumnType("nvarchar(128)");
+
+                    b.Property<string>("Data")
+                        .HasMaxLength(3600)
+                        .HasColumnType("nvarchar(3600)");
+
+                    b.Property<string>("EvseendPoint")
+                        .HasMaxLength(25)
+                        .HasColumnType("nvarchar(25)")
+                        .HasColumnName("EVSEEndPoint");
+
+                    b.Property<bool>("IsSent")
+                        .HasColumnType("bit");
+
+                    b.Property<string>("MessageType")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<string>("Msg")
+                        .HasMaxLength(200)
+                        .HasColumnType("nvarchar(200)");
+
+                    b.Property<string>("Session")
+                        .HasMaxLength(36)
+                        .HasColumnType("nvarchar(36)");
+
+                    b.HasKey("Id", "CreatedOn");
+
+                    b.ToTable("MachineConnectionLog", (string)null);
+                });
+#pragma warning restore 612, 618
+        }
+    }
+}

+ 1071 - 0
EVCB_OCPP.Domain/Migrations/MainDBContextModelSnapshot.cs

@@ -0,0 +1,1071 @@
+// <auto-generated />
+using System;
+using EVCB_OCPP.Domain;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Metadata;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+
+#nullable disable
+
+namespace EVCB_OCPP.Domain.Migrations
+{
+    [DbContext(typeof(MainDBContext))]
+    partial class MainDBContextModelSnapshot : ModelSnapshot
+    {
+        protected override void BuildModel(ModelBuilder modelBuilder)
+        {
+#pragma warning disable 612, 618
+            modelBuilder
+                .UseCollation("Chinese_Taiwan_Stroke_CI_AS")
+                .HasAnnotation("ProductVersion", "7.0.12")
+                .HasAnnotation("Relational:MaxIdentifierLength", 128);
+
+            SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
+
+            modelBuilder.Entity("EVCB_OCPP.Domain.Models.MainDb.ConnectorMeterValueRecord", b =>
+                {
+                    b.Property<long>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("bigint");
+
+                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"));
+
+                    b.Property<string>("ChargeBoxId")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<byte>("ConnectorId")
+                        .HasColumnType("tinyint");
+
+                    b.Property<int>("ContextId")
+                        .HasColumnType("int");
+
+                    b.Property<DateTime>("CreatedOn")
+                        .HasColumnType("datetime");
+
+                    b.Property<int>("FormatId")
+                        .HasColumnType("int");
+
+                    b.Property<int>("LocationId")
+                        .HasColumnType("int");
+
+                    b.Property<int>("MeasurandId")
+                        .HasColumnType("int");
+
+                    b.Property<int>("PhaseId")
+                        .HasColumnType("int");
+
+                    b.Property<int>("TransactionId")
+                        .HasColumnType("int");
+
+                    b.Property<int>("UnitId")
+                        .HasColumnType("int");
+
+                    b.Property<string>("Value")
+                        .HasMaxLength(10)
+                        .HasColumnType("nvarchar(10)");
+
+                    b.HasKey("Id")
+                        .HasName("PK_dbo.ConnectorMeterValueRecord");
+
+                    b.ToTable("ConnectorMeterValueRecord", (string)null);
+                });
+
+            modelBuilder.Entity("EVCB_OCPP.Domain.Models.MainDb.ConnectorStatus", b =>
+                {
+                    b.Property<string>("Id")
+                        .HasMaxLength(36)
+                        .HasColumnType("nvarchar(36)");
+
+                    b.Property<string>("ChargeBoxId")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<int>("ChargePointErrorCodeId")
+                        .HasColumnType("int");
+
+                    b.Property<byte>("ConnectorId")
+                        .HasColumnType("tinyint");
+
+                    b.Property<DateTime>("CreatedOn")
+                        .HasColumnType("datetime");
+
+                    b.Property<string>("ErrorInfo")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<int>("Status")
+                        .HasColumnType("int");
+
+                    b.Property<decimal>("TotalEnergy")
+                        .HasColumnType("decimal(10, 2)");
+
+                    b.Property<int>("Type")
+                        .HasColumnType("int");
+
+                    b.Property<string>("VendorErrorCode")
+                        .HasMaxLength(100)
+                        .HasColumnType("nvarchar(100)");
+
+                    b.Property<string>("VendorId")
+                        .HasMaxLength(255)
+                        .HasColumnType("nvarchar(255)");
+
+                    b.HasKey("Id")
+                        .HasName("PK_dbo.ConnectorStatus");
+
+                    b.HasIndex(new[] { "ChargeBoxId", "ConnectorId" }, "IX_ConnectorStatus")
+                        .IsUnique()
+                        .HasFilter("[ChargeBoxId] IS NOT NULL");
+
+                    b.ToTable("ConnectorStatus", (string)null);
+                });
+
+            modelBuilder.Entity("EVCB_OCPP.Domain.Models.MainDb.Customer", b =>
+                {
+                    b.Property<Guid>("Id")
+                        .HasColumnType("uniqueidentifier");
+
+                    b.Property<string>("ApiCustomerId")
+                        .HasMaxLength(36)
+                        .HasColumnType("nvarchar(36)");
+
+                    b.Property<string>("ApiKey")
+                        .HasMaxLength(128)
+                        .HasColumnType("nvarchar(128)");
+
+                    b.Property<DateTime?>("ApiKeyUpdatedOn")
+                        .HasColumnType("datetime");
+
+                    b.Property<string>("ApiUrl")
+                        .HasMaxLength(256)
+                        .HasColumnType("nvarchar(256)");
+
+                    b.Property<bool>("CallPartnerApiOnSchedule")
+                        .HasColumnType("bit");
+
+                    b.Property<string>("CreatedBy")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<DateTime>("CreatedOn")
+                        .HasColumnType("datetime");
+
+                    b.Property<DateTime?>("Deadline")
+                        .HasColumnType("datetime");
+
+                    b.Property<bool>("EnableTtia")
+                        .HasColumnType("bit")
+                        .HasColumnName("EnableTTIA");
+
+                    b.Property<string>("Ftphost")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)")
+                        .HasColumnName("FTPHost");
+
+                    b.Property<string>("Ftppassword")
+                        .HasMaxLength(20)
+                        .HasColumnType("nvarchar(20)")
+                        .HasColumnName("FTPPassword");
+
+                    b.Property<string>("Ftppath")
+                        .HasColumnType("nvarchar(max)")
+                        .HasColumnName("FTPPath");
+
+                    b.Property<string>("Ftpuser")
+                        .HasMaxLength(20)
+                        .HasColumnType("nvarchar(20)")
+                        .HasColumnName("FTPUser");
+
+                    b.Property<bool>("InstantStopTxReport")
+                        .HasColumnType("bit");
+
+                    b.Property<bool>("IsShow")
+                        .HasColumnType("bit");
+
+                    b.Property<string>("Name")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<string>("PartnerId")
+                        .HasMaxLength(36)
+                        .HasColumnType("nvarchar(36)");
+
+                    b.Property<string>("TtiaApikey")
+                        .HasMaxLength(10)
+                        .HasColumnType("nvarchar(10)")
+                        .HasColumnName("TTIA_APIKey");
+
+                    b.Property<string>("TtiaApiurl")
+                        .HasMaxLength(100)
+                        .HasColumnType("nvarchar(100)")
+                        .HasColumnName("TTIA_APIUrl");
+
+                    b.Property<int>("TtiaCustomerId")
+                        .HasColumnType("int")
+                        .HasColumnName("TTIA_CustomerId");
+
+                    b.Property<string>("TtiaEquipmentProvider")
+                        .HasMaxLength(10)
+                        .HasColumnType("nvarchar(10)")
+                        .HasColumnName("TTIA_EquipmentProvider");
+
+                    b.Property<string>("UpdatedBy")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<DateTime?>("UpdatedOn")
+                        .HasColumnType("datetime");
+
+                    b.HasKey("Id")
+                        .HasName("PK_dbo.Customer");
+
+                    b.ToTable("Customer", (string)null);
+                });
+
+            modelBuilder.Entity("EVCB_OCPP.Domain.Models.MainDb.LoadingBalance", b =>
+                {
+                    b.Property<long>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("bigint");
+
+                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"));
+
+                    b.Property<DateTime>("CreatedOn")
+                        .HasColumnType("datetime");
+
+                    b.Property<DateTime>("FinishedOn")
+                        .HasColumnType("datetime");
+
+                    b.Property<string>("MachineId")
+                        .IsRequired()
+                        .HasMaxLength(36)
+                        .HasColumnType("nvarchar(36)");
+
+                    b.Property<decimal>("Power")
+                        .HasColumnType("decimal(10, 2)");
+
+                    b.Property<int>("StationId")
+                        .HasColumnType("int");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("LoadingBalance", (string)null);
+                });
+
+            modelBuilder.Entity("EVCB_OCPP.Domain.Models.MainDb.Machine", b =>
+                {
+                    b.Property<string>("Id")
+                        .HasMaxLength(36)
+                        .HasColumnType("nvarchar(36)");
+
+                    b.Property<string>("BoardVersions")
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("ChargeBoxId")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<string>("ChargeBoxSerialNumber")
+                        .HasMaxLength(25)
+                        .HasColumnType("nvarchar(25)");
+
+                    b.Property<string>("ChargePointModel")
+                        .HasMaxLength(20)
+                        .HasColumnType("nvarchar(20)");
+
+                    b.Property<string>("ChargePointSerialNumber")
+                        .HasMaxLength(25)
+                        .HasColumnType("nvarchar(25)");
+
+                    b.Property<string>("ChargePointVendor")
+                        .HasMaxLength(20)
+                        .HasColumnType("nvarchar(20)");
+
+                    b.Property<string>("Comment")
+                        .HasMaxLength(100)
+                        .HasColumnType("nvarchar(100)");
+
+                    b.Property<int>("ConnectionType")
+                        .HasColumnType("int");
+
+                    b.Property<string>("ConnectorPowerType")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<string>("ConnectorType")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<string>("CreatedBy")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<DateTime>("CreatedOn")
+                        .HasColumnType("datetime");
+
+                    b.Property<Guid>("CustomerId")
+                        .HasColumnType("uniqueidentifier");
+
+                    b.Property<int?>("FwAssignedVersion")
+                        .HasColumnType("int")
+                        .HasColumnName("FW_AssignedVersion");
+
+                    b.Property<string>("FwCurrentVersion")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)")
+                        .HasColumnName("FW_CurrentVersion");
+
+                    b.Property<int?>("FwVersionReport")
+                        .HasColumnType("int")
+                        .HasColumnName("FW_VersionReport");
+
+                    b.Property<int>("GunAmt")
+                        .HasColumnType("int");
+
+                    b.Property<DateTime>("HeartbeatUpdatedOn")
+                        .HasColumnType("datetime");
+
+                    b.Property<string>("Iccid")
+                        .HasMaxLength(20)
+                        .HasColumnType("nvarchar(20)");
+
+                    b.Property<string>("Imsi")
+                        .HasMaxLength(20)
+                        .HasColumnType("nvarchar(20)");
+
+                    b.Property<bool>("IsDelete")
+                        .HasColumnType("bit");
+
+                    b.Property<decimal>("Latitude")
+                        .HasColumnType("decimal(10, 6)");
+
+                    b.Property<decimal>("Longitude")
+                        .HasColumnType("decimal(10, 6)");
+
+                    b.Property<string>("MeterSerialNumber")
+                        .HasMaxLength(25)
+                        .HasColumnType("nvarchar(25)");
+
+                    b.Property<string>("MeterType")
+                        .HasMaxLength(25)
+                        .HasColumnType("nvarchar(25)");
+
+                    b.Property<string>("ModelName")
+                        .IsRequired()
+                        .ValueGeneratedOnAdd()
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)")
+                        .HasDefaultValueSql("('')");
+
+                    b.Property<DateTime?>("OfflineOn")
+                        .HasColumnType("datetime");
+
+                    b.Property<bool>("Online")
+                        .HasColumnType("bit");
+
+                    b.Property<decimal>("RatedPower")
+                        .HasColumnType("decimal(6, 2)");
+
+                    b.Property<int>("Ttiatag")
+                        .HasColumnType("int")
+                        .HasColumnName("TTIATag");
+
+                    b.Property<string>("VendorId")
+                        .ValueGeneratedOnAdd()
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)")
+                        .HasDefaultValueSql("('Zerova')");
+
+                    b.HasKey("Id")
+                        .HasName("PK_dbo.Machine");
+
+                    b.HasIndex(new[] { "CustomerId", "ChargeBoxId" }, "nci_wi_Machine_7CD4A9D1688F96F6967B2244A0666F62");
+
+                    b.ToTable("Machine", (string)null);
+                });
+
+            modelBuilder.Entity("EVCB_OCPP.Domain.Models.MainDb.MachineConfiguration", b =>
+                {
+                    b.Property<string>("ConfigureName")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<string>("ChargeBoxId")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<string>("ConfigureSetting")
+                        .HasMaxLength(500)
+                        .HasColumnType("nvarchar(500)");
+
+                    b.Property<bool>("Exists")
+                        .HasColumnType("bit");
+
+                    b.Property<int>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("int");
+
+                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
+
+                    b.Property<bool>("ReadOnly")
+                        .HasColumnType("bit");
+
+                    b.HasKey("ConfigureName", "ChargeBoxId")
+                        .HasName("PK_dbo.MachineConfigurations");
+
+                    b.HasIndex(new[] { "ConfigureName", "ConfigureSetting" }, "nci_wi_MachineConfigurations_132E765C043BF95A2570D2EA019DD783");
+
+                    b.ToTable("MachineConfigurations");
+                });
+
+            modelBuilder.Entity("EVCB_OCPP.Domain.Models.MainDb.MachineError", b =>
+                {
+                    b.Property<int>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("int");
+
+                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
+
+                    b.Property<string>("ChargeBoxId")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<byte>("ConnectorId")
+                        .HasColumnType("tinyint");
+
+                    b.Property<DateTime>("CreatedOn")
+                        .HasColumnType("datetime");
+
+                    b.Property<int>("ErrorCodeId")
+                        .HasColumnType("int");
+
+                    b.Property<string>("ErrorInfo")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<int>("PreStatus")
+                        .HasColumnType("int");
+
+                    b.Property<int>("Status")
+                        .HasColumnType("int");
+
+                    b.Property<string>("VendorErrorCode")
+                        .HasMaxLength(100)
+                        .HasColumnType("nvarchar(100)");
+
+                    b.Property<string>("VendorId")
+                        .HasMaxLength(255)
+                        .HasColumnType("nvarchar(255)");
+
+                    b.HasKey("Id")
+                        .HasName("PK_dbo.MachineError");
+
+                    b.ToTable("MachineError", (string)null);
+                });
+
+            modelBuilder.Entity("EVCB_OCPP.Domain.Models.MainDb.MachineOperateRecord", b =>
+                {
+                    b.Property<int>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("int");
+
+                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
+
+                    b.Property<string>("Action")
+                        .HasMaxLength(30)
+                        .HasColumnType("nvarchar(30)");
+
+                    b.Property<string>("ChargeBoxId")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<DateTime>("CreatedOn")
+                        .HasColumnType("datetime");
+
+                    b.Property<int>("EvseStatus")
+                        .HasColumnType("int")
+                        .HasColumnName("EVSE_Status");
+
+                    b.Property<string>("EvseValue")
+                        .HasColumnType("nvarchar(max)")
+                        .HasColumnName("EVSE_Value");
+
+                    b.Property<DateTime>("FinishedOn")
+                        .HasColumnType("datetime");
+
+                    b.Property<DateTime>("ReportedOn")
+                        .HasColumnType("datetime");
+
+                    b.Property<string>("RequestContent")
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<int>("RequestType")
+                        .HasColumnType("int");
+
+                    b.Property<string>("SerialNo")
+                        .HasMaxLength(36)
+                        .HasColumnType("nvarchar(36)");
+
+                    b.Property<int>("Status")
+                        .HasColumnType("int");
+
+                    b.HasKey("Id")
+                        .HasName("PK_dbo.MachineOperateRecord");
+
+                    b.ToTable("MachineOperateRecord", (string)null);
+                });
+
+            modelBuilder.Entity("EVCB_OCPP.Domain.Models.MainDb.MachineVersionFile", b =>
+                {
+                    b.Property<int>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("int");
+
+                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
+
+                    b.Property<string>("ChargeBoxId")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<DateTime>("CreatedOn")
+                        .HasColumnType("datetime");
+
+                    b.Property<int>("Seq")
+                        .HasColumnType("int");
+
+                    b.Property<string>("UploadFileId")
+                        .IsRequired()
+                        .HasMaxLength(36)
+                        .HasColumnType("nvarchar(36)");
+
+                    b.HasKey("Id")
+                        .HasName("PK_dbo.MachineVersionFile");
+
+                    b.HasIndex("UploadFileId");
+
+                    b.ToTable("MachineVersionFile", (string)null);
+                });
+
+            modelBuilder.Entity("EVCB_OCPP.Domain.Models.MainDb.MigrationHistory", b =>
+                {
+                    b.Property<string>("MigrationId")
+                        .HasMaxLength(150)
+                        .HasColumnType("nvarchar(150)");
+
+                    b.Property<string>("ContextKey")
+                        .HasMaxLength(300)
+                        .HasColumnType("nvarchar(300)");
+
+                    b.Property<byte[]>("Model")
+                        .IsRequired()
+                        .HasColumnType("varbinary(max)");
+
+                    b.Property<string>("ProductVersion")
+                        .IsRequired()
+                        .HasMaxLength(32)
+                        .HasColumnType("nvarchar(32)");
+
+                    b.HasKey("MigrationId", "ContextKey")
+                        .HasName("PK_dbo.__MigrationHistory");
+
+                    b.ToTable("__MigrationHistory", (string)null);
+                });
+
+            modelBuilder.Entity("EVCB_OCPP.Domain.Models.MainDb.Ocmf", b =>
+                {
+                    b.Property<int>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("int");
+
+                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
+
+                    b.Property<string>("DataString")
+                        .HasMaxLength(2048)
+                        .HasColumnType("nvarchar(2048)");
+
+                    b.Property<string>("PublicKey")
+                        .HasMaxLength(256)
+                        .HasColumnType("nvarchar(256)");
+
+                    b.Property<int>("TransactionId")
+                        .HasColumnType("int");
+
+                    b.HasKey("Id")
+                        .HasName("PK_dbo.OCMF");
+
+                    b.ToTable("OCMF", (string)null);
+                });
+
+            modelBuilder.Entity("EVCB_OCPP.Domain.Models.MainDb.ServerMessage", b =>
+                {
+                    b.Property<int>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("int");
+
+                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
+
+                    b.Property<string>("ChargeBoxId")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<string>("CreatedBy")
+                        .HasMaxLength(36)
+                        .HasColumnType("nvarchar(36)");
+
+                    b.Property<DateTime>("CreatedOn")
+                        .HasColumnType("datetime");
+
+                    b.Property<string>("InMessage")
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("OutAction")
+                        .HasMaxLength(30)
+                        .HasColumnType("nvarchar(30)");
+
+                    b.Property<string>("OutRequest")
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<DateTime>("ReceivedOn")
+                        .HasColumnType("datetime");
+
+                    b.Property<string>("SerialNo")
+                        .HasMaxLength(36)
+                        .HasColumnType("nvarchar(36)");
+
+                    b.Property<DateTime>("UpdatedOn")
+                        .HasColumnType("datetime");
+
+                    b.HasKey("Id")
+                        .HasName("PK_dbo.ServerMessage");
+
+                    b.HasIndex(new[] { "ReceivedOn", "UpdatedOn", "CreatedOn" }, "nci_wi_ServerMessage_EC00C205420F6CB01974705B93F9507F");
+
+                    b.ToTable("ServerMessage", (string)null);
+                });
+
+            modelBuilder.Entity("EVCB_OCPP.Domain.Models.MainDb.TransactionRecord", b =>
+                {
+                    b.Property<int>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("int");
+
+                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
+
+                    b.Property<bool>("BillingDone")
+                        .HasColumnType("bit");
+
+                    b.Property<string>("ChargeBoxId")
+                        .IsRequired()
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<byte>("ConnectorId")
+                        .HasColumnType("tinyint");
+
+                    b.Property<decimal>("Cost")
+                        .HasColumnType("decimal(18, 2)");
+
+                    b.Property<DateTime>("CreatedOn")
+                        .HasColumnType("datetime");
+
+                    b.Property<Guid>("CustomerId")
+                        .HasColumnType("uniqueidentifier");
+
+                    b.Property<string>("ErrorMsg")
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("Evccid")
+                        .HasMaxLength(30)
+                        .HasColumnType("nvarchar(30)")
+                        .HasColumnName("EVCCID");
+
+                    b.Property<string>("Fee")
+                        .HasMaxLength(1500)
+                        .HasColumnType("nvarchar(1500)");
+
+                    b.Property<decimal>("MeterStart")
+                        .HasColumnType("decimal(18, 2)");
+
+                    b.Property<decimal>("MeterStop")
+                        .HasColumnType("decimal(18, 2)");
+
+                    b.Property<bool>("NotifyPnC")
+                        .HasColumnType("bit");
+
+                    b.Property<string>("Receipt")
+                        .HasMaxLength(3000)
+                        .HasColumnType("nvarchar(3000)");
+
+                    b.Property<int>("ReservationId")
+                        .HasColumnType("int");
+
+                    b.Property<int>("RetryStartTransactionTimes")
+                        .HasColumnType("int");
+
+                    b.Property<int>("RetryStopTransactionTimes")
+                        .HasColumnType("int");
+
+                    b.Property<string>("StartIdTag")
+                        .HasMaxLength(20)
+                        .HasColumnType("nvarchar(20)");
+
+                    b.Property<string>("StartSoc")
+                        .HasMaxLength(3)
+                        .HasColumnType("nvarchar(3)")
+                        .HasColumnName("StartSOC");
+
+                    b.Property<DateTime>("StartTime")
+                        .HasColumnType("datetime");
+
+                    b.Property<DateTime>("StartTransactionReportedOn")
+                        .HasColumnType("datetime");
+
+                    b.Property<string>("StopIdTag")
+                        .HasMaxLength(20)
+                        .HasColumnType("nvarchar(20)");
+
+                    b.Property<string>("StopReason")
+                        .HasMaxLength(60)
+                        .HasColumnType("nvarchar(60)");
+
+                    b.Property<int>("StopReasonId")
+                        .HasColumnType("int");
+
+                    b.Property<string>("StopSoc")
+                        .HasMaxLength(3)
+                        .HasColumnType("nvarchar(3)")
+                        .HasColumnName("StopSOC");
+
+                    b.Property<DateTime>("StopTime")
+                        .HasColumnType("datetime");
+
+                    b.Property<DateTime>("StopTransactionReportedOn")
+                        .HasColumnType("datetime");
+
+                    b.Property<DateTime>("UpdatedOn")
+                        .HasColumnType("datetime");
+
+                    b.Property<bool>("UploadedtoTtia")
+                        .HasColumnType("bit")
+                        .HasColumnName("UploadedtoTTIA");
+
+                    b.HasKey("Id")
+                        .HasName("PK_dbo.TransactionRecord");
+
+                    b.HasIndex(new[] { "CustomerId", "ConnectorId", "StartTime", "ChargeBoxId" }, "IX_TransactionRecord_StartTime");
+
+                    b.HasIndex(new[] { "CustomerId", "StopTransactionReportedOn", "StopTime" }, "nci_wi_TransactionRecord_92D4DF08E7034102014AC91760F890FE");
+
+                    b.ToTable("TransactionRecord", (string)null);
+                });
+
+            modelBuilder.Entity("EVCB_OCPP.Domain.Models.MainDb.UploadFile", b =>
+                {
+                    b.Property<string>("Id")
+                        .HasMaxLength(36)
+                        .HasColumnType("nvarchar(36)");
+
+                    b.Property<string>("CreatedBy")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<DateTime>("CreatedOn")
+                        .HasColumnType("datetime");
+
+                    b.Property<string>("FileExtensionName")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<string>("FileMd5")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)")
+                        .HasColumnName("FileMD5");
+
+                    b.Property<string>("FileName")
+                        .IsRequired()
+                        .HasMaxLength(500)
+                        .HasColumnType("nvarchar(500)");
+
+                    b.Property<string>("FilePath")
+                        .IsRequired()
+                        .HasMaxLength(500)
+                        .HasColumnType("nvarchar(500)");
+
+                    b.Property<int>("FileSize")
+                        .HasColumnType("int");
+
+                    b.Property<string>("FileType")
+                        .HasMaxLength(200)
+                        .HasColumnType("nvarchar(200)");
+
+                    b.Property<string>("FileUrl")
+                        .HasMaxLength(512)
+                        .HasColumnType("nvarchar(512)");
+
+                    b.Property<string>("ModelName")
+                        .IsRequired()
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<int>("ModuleId")
+                        .HasColumnType("int");
+
+                    b.Property<string>("OriginName")
+                        .IsRequired()
+                        .HasMaxLength(500)
+                        .HasColumnType("nvarchar(500)");
+
+                    b.Property<string>("VendorId")
+                        .IsRequired()
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.HasKey("Id")
+                        .HasName("PK_dbo.UploadFile");
+
+                    b.ToTable("UploadFile", (string)null);
+                });
+
+            modelBuilder.Entity("EVCB_OCPP.Domain.Models.MainDb.VConnectorStatus", b =>
+                {
+                    b.Property<string>("ChargeBoxId")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<int>("ChargePointErrorCodeId")
+                        .HasColumnType("int");
+
+                    b.Property<byte>("ConnectorId")
+                        .HasColumnType("tinyint");
+
+                    b.Property<DateTime>("CreatedOn")
+                        .HasColumnType("datetime");
+
+                    b.Property<string>("ErrorInfo")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<string>("Id")
+                        .IsRequired()
+                        .HasMaxLength(36)
+                        .HasColumnType("nvarchar(36)");
+
+                    b.Property<int>("Status")
+                        .HasColumnType("int");
+
+                    b.Property<decimal>("TotalEnergy")
+                        .HasColumnType("decimal(10, 2)");
+
+                    b.Property<int>("Type")
+                        .HasColumnType("int");
+
+                    b.Property<string>("VendorErrorCode")
+                        .HasMaxLength(100)
+                        .HasColumnType("nvarchar(100)");
+
+                    b.Property<string>("VendorId")
+                        .HasMaxLength(255)
+                        .HasColumnType("nvarchar(255)");
+
+                    b.ToTable((string)null);
+
+                    b.ToView("vConnectorStatus", (string)null);
+                });
+
+            modelBuilder.Entity("EVCB_OCPP.Domain.Models.MainDb.VConnectorStatusCombind", b =>
+                {
+                    b.Property<string>("ChargeBoxId")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<int>("ChargePointErrorCodeId")
+                        .HasColumnType("int");
+
+                    b.Property<byte>("ConnectorId")
+                        .HasColumnType("tinyint");
+
+                    b.Property<string>("Ocpp")
+                        .IsRequired()
+                        .HasMaxLength(3)
+                        .IsUnicode(false)
+                        .HasColumnType("varchar(3)")
+                        .HasColumnName("OCPP");
+
+                    b.Property<int>("Status")
+                        .HasColumnType("int");
+
+                    b.Property<decimal>("TotalEnergy")
+                        .HasColumnType("decimal(10, 2)");
+
+                    b.Property<int>("Type")
+                        .HasColumnType("int");
+
+                    b.Property<string>("VendorErrorCode")
+                        .HasMaxLength(100)
+                        .HasColumnType("nvarchar(100)");
+
+                    b.ToTable((string)null);
+
+                    b.ToView("vConnectorStatusCombind", (string)null);
+                });
+
+            modelBuilder.Entity("EVCB_OCPP.Domain.Models.MainDb.VMachine", b =>
+                {
+                    b.Property<string>("ChargeBoxId")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<int>("ConnectionType")
+                        .HasColumnType("int");
+
+                    b.Property<string>("ConnectorType")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<Guid>("CustomerId")
+                        .HasColumnType("uniqueidentifier");
+
+                    b.Property<int>("GunAmt")
+                        .HasColumnType("int");
+
+                    b.Property<DateTime>("HeartbeatUpdatedOn")
+                        .HasColumnType("datetime");
+
+                    b.Property<string>("Id")
+                        .IsRequired()
+                        .HasMaxLength(36)
+                        .HasColumnType("nvarchar(36)");
+
+                    b.Property<bool>("IsDelete")
+                        .HasColumnType("bit");
+
+                    b.Property<string>("ModelName")
+                        .IsRequired()
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<DateTime?>("OfflineOn")
+                        .HasColumnType("datetime");
+
+                    b.Property<bool>("Online")
+                        .HasColumnType("bit");
+
+                    b.Property<decimal>("RatedPower")
+                        .HasColumnType("decimal(6, 2)");
+
+                    b.Property<int>("Ttiatag")
+                        .HasColumnType("int")
+                        .HasColumnName("TTIATag");
+
+                    b.Property<string>("VendorId")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.ToTable((string)null);
+
+                    b.ToView("vMachine", (string)null);
+                });
+
+            modelBuilder.Entity("EVCB_OCPP.Domain.Models.MainDb.VMachineCombind", b =>
+                {
+                    b.Property<string>("ChargeBoxId")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<int>("ConnectionType")
+                        .HasColumnType("int");
+
+                    b.Property<string>("ConnectorType")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<Guid>("CustomerId")
+                        .HasColumnType("uniqueidentifier");
+
+                    b.Property<int>("GunAmt")
+                        .HasColumnType("int");
+
+                    b.Property<DateTime>("HeartbeatUpdatedOn")
+                        .HasColumnType("datetime");
+
+                    b.Property<string>("Id")
+                        .IsRequired()
+                        .HasMaxLength(36)
+                        .HasColumnType("nvarchar(36)");
+
+                    b.Property<bool>("IsDelete")
+                        .HasColumnType("bit");
+
+                    b.Property<string>("ModelName")
+                        .IsRequired()
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<string>("Ocpp")
+                        .IsRequired()
+                        .HasMaxLength(3)
+                        .IsUnicode(false)
+                        .HasColumnType("varchar(3)")
+                        .HasColumnName("OCPP");
+
+                    b.Property<DateTime?>("OfflineOn")
+                        .HasColumnType("datetime");
+
+                    b.Property<bool>("Online")
+                        .HasColumnType("bit");
+
+                    b.Property<decimal>("RatedPower")
+                        .HasColumnType("decimal(6, 2)");
+
+                    b.Property<int>("Ttiatag")
+                        .HasColumnType("int")
+                        .HasColumnName("TTIATag");
+
+                    b.Property<string>("VendorId")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.ToTable((string)null);
+
+                    b.ToView("vMachineCombind", (string)null);
+                });
+
+            modelBuilder.Entity("EVCB_OCPP.Domain.Models.MainDb.Machine", b =>
+                {
+                    b.HasOne("EVCB_OCPP.Domain.Models.MainDb.Customer", "Customer")
+                        .WithMany("Machines")
+                        .HasForeignKey("CustomerId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired()
+                        .HasConstraintName("FK_dbo.Machine_dbo.Customer_CustomerId");
+
+                    b.Navigation("Customer");
+                });
+
+            modelBuilder.Entity("EVCB_OCPP.Domain.Models.MainDb.MachineVersionFile", b =>
+                {
+                    b.HasOne("EVCB_OCPP.Domain.Models.MainDb.UploadFile", "UploadFile")
+                        .WithMany("MachineVersionFiles")
+                        .HasForeignKey("UploadFileId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired()
+                        .HasConstraintName("FK_dbo.MachineVersionFile_dbo.UploadFile_UploadFileId");
+
+                    b.Navigation("UploadFile");
+                });
+
+            modelBuilder.Entity("EVCB_OCPP.Domain.Models.MainDb.Customer", b =>
+                {
+                    b.Navigation("Machines");
+                });
+
+            modelBuilder.Entity("EVCB_OCPP.Domain.Models.MainDb.UploadFile", b =>
+                {
+                    b.Navigation("MachineVersionFiles");
+                });
+#pragma warning restore 612, 618
+        }
+    }
+}

+ 74 - 0
EVCB_OCPP.Domain/Migrations/MeterValueDB/20231019091245_InitialCreate.Designer.cs

@@ -0,0 +1,74 @@
+// <auto-generated />
+using System;
+using EVCB_OCPP.Domain;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Metadata;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+
+#nullable disable
+
+namespace EVCB_OCPP.Domain.Migrations.MeterValueDB
+{
+    [DbContext(typeof(MeterValueDBContext))]
+    [Migration("20231019091245_InitialCreate")]
+    partial class InitialCreate
+    {
+        /// <inheritdoc />
+        protected override void BuildTargetModel(ModelBuilder modelBuilder)
+        {
+#pragma warning disable 612, 618
+            modelBuilder
+                .UseCollation("Chinese_Taiwan_Stroke_CI_AS")
+                .HasAnnotation("ProductVersion", "7.0.12")
+                .HasAnnotation("Relational:MaxIdentifierLength", 128);
+
+            SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
+
+            modelBuilder.Entity("EVCB_OCPP.Domain.Models.MeterValueDb.ConnectorMeterValueRecord", b =>
+                {
+                    b.Property<string>("ChargeBoxId")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<byte>("ConnectorId")
+                        .HasColumnType("tinyint");
+
+                    b.Property<int>("ContextId")
+                        .HasColumnType("int");
+
+                    b.Property<DateTime>("CreatedOn")
+                        .HasColumnType("smalldatetime");
+
+                    b.Property<int>("FormatId")
+                        .HasColumnType("int");
+
+                    b.Property<long>("Id")
+                        .HasColumnType("bigint");
+
+                    b.Property<int>("LocationId")
+                        .HasColumnType("int");
+
+                    b.Property<int>("MeasurandId")
+                        .HasColumnType("int");
+
+                    b.Property<int>("PhaseId")
+                        .HasColumnType("int");
+
+                    b.Property<int>("TransactionId")
+                        .HasColumnType("int");
+
+                    b.Property<int>("UnitId")
+                        .HasColumnType("int");
+
+                    b.Property<string>("Value")
+                        .HasMaxLength(10)
+                        .HasColumnType("nvarchar(10)");
+
+                    b.ToTable("ConnectorMeterValueRecord", (string)null);
+                });
+#pragma warning restore 612, 618
+        }
+    }
+}

+ 43 - 0
EVCB_OCPP.Domain/Migrations/MeterValueDB/20231019091245_InitialCreate.cs

@@ -0,0 +1,43 @@
+using System;
+using Microsoft.EntityFrameworkCore.Migrations;
+
+#nullable disable
+
+namespace EVCB_OCPP.Domain.Migrations.MeterValueDB
+{
+    /// <inheritdoc />
+    public partial class InitialCreate : Migration
+    {
+        /// <inheritdoc />
+        protected override void Up(MigrationBuilder migrationBuilder)
+        {
+            migrationBuilder.CreateTable(
+                name: "ConnectorMeterValueRecord",
+                columns: table => new
+                {
+                    Id = table.Column<long>(type: "bigint", nullable: false),
+                    ConnectorId = table.Column<byte>(type: "tinyint", nullable: false),
+                    Value = table.Column<string>(type: "nvarchar(10)", maxLength: 10, nullable: true),
+                    CreatedOn = table.Column<DateTime>(type: "smalldatetime", nullable: false),
+                    ContextId = table.Column<int>(type: "int", nullable: false),
+                    FormatId = table.Column<int>(type: "int", nullable: false),
+                    MeasurandId = table.Column<int>(type: "int", nullable: false),
+                    PhaseId = table.Column<int>(type: "int", nullable: false),
+                    LocationId = table.Column<int>(type: "int", nullable: false),
+                    UnitId = table.Column<int>(type: "int", nullable: false),
+                    ChargeBoxId = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
+                    TransactionId = table.Column<int>(type: "int", nullable: false)
+                },
+                constraints: table =>
+                {
+                });
+        }
+
+        /// <inheritdoc />
+        protected override void Down(MigrationBuilder migrationBuilder)
+        {
+            migrationBuilder.DropTable(
+                name: "ConnectorMeterValueRecord");
+        }
+    }
+}

+ 71 - 0
EVCB_OCPP.Domain/Migrations/MeterValueDB/MeterValueDBContextModelSnapshot.cs

@@ -0,0 +1,71 @@
+// <auto-generated />
+using System;
+using EVCB_OCPP.Domain;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Metadata;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+
+#nullable disable
+
+namespace EVCB_OCPP.Domain.Migrations.MeterValueDB
+{
+    [DbContext(typeof(MeterValueDBContext))]
+    partial class MeterValueDBContextModelSnapshot : ModelSnapshot
+    {
+        protected override void BuildModel(ModelBuilder modelBuilder)
+        {
+#pragma warning disable 612, 618
+            modelBuilder
+                .UseCollation("Chinese_Taiwan_Stroke_CI_AS")
+                .HasAnnotation("ProductVersion", "7.0.12")
+                .HasAnnotation("Relational:MaxIdentifierLength", 128);
+
+            SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
+
+            modelBuilder.Entity("EVCB_OCPP.Domain.Models.MeterValueDb.ConnectorMeterValueRecord", b =>
+                {
+                    b.Property<string>("ChargeBoxId")
+                        .HasMaxLength(50)
+                        .HasColumnType("nvarchar(50)");
+
+                    b.Property<byte>("ConnectorId")
+                        .HasColumnType("tinyint");
+
+                    b.Property<int>("ContextId")
+                        .HasColumnType("int");
+
+                    b.Property<DateTime>("CreatedOn")
+                        .HasColumnType("smalldatetime");
+
+                    b.Property<int>("FormatId")
+                        .HasColumnType("int");
+
+                    b.Property<long>("Id")
+                        .HasColumnType("bigint");
+
+                    b.Property<int>("LocationId")
+                        .HasColumnType("int");
+
+                    b.Property<int>("MeasurandId")
+                        .HasColumnType("int");
+
+                    b.Property<int>("PhaseId")
+                        .HasColumnType("int");
+
+                    b.Property<int>("TransactionId")
+                        .HasColumnType("int");
+
+                    b.Property<int>("UnitId")
+                        .HasColumnType("int");
+
+                    b.Property<string>("Value")
+                        .HasMaxLength(10)
+                        .HasColumnType("nvarchar(10)");
+
+                    b.ToTable("ConnectorMeterValueRecord", (string)null);
+                });
+#pragma warning restore 612, 618
+        }
+    }
+}

+ 25 - 0
EVCB_OCPP.Domain/Models/ConnectionLogDB/MachineConnectionLog.cs

@@ -0,0 +1,25 @@
+using System;
+using System.Collections.Generic;
+
+namespace EVCB_OCPP.Domain.Models.ConnectionLogDB;
+
+public partial class MachineConnectionLog
+{
+    public long Id { get; set; }
+
+    public string MessageType { get; set; }
+
+    public string Data { get; set; }
+
+    public string Msg { get; set; }
+
+    public DateTime CreatedOn { get; set; }
+
+    public string ChargeBoxId { get; set; }
+
+    public bool IsSent { get; set; }
+
+    public string EvseendPoint { get; set; }
+
+    public string Session { get; set; }
+}

+ 0 - 121
EVCB_OCPP.Domain/Models/Database/ApiLogEntry.cs

@@ -1,121 +0,0 @@
-namespace EVCB_OCPP.Domain.Models.Database
-{
-    using Microsoft.EntityFrameworkCore;
-    using System;
-    using System.Collections.Generic;
-    using System.ComponentModel;
-    using System.ComponentModel.DataAnnotations;
-    using System.ComponentModel.DataAnnotations.Schema;
-
-    [Table("ApiLogEntry")]
-    [Index(nameof(RequestTimestamp), IsUnique = true)]
-    public class ApiLogEntry
-    {
-        /// <summary>
-        /// // The (database) ID for the API log entry.
-        /// </summary>
-        [Key]
-        public long ApiLogEntryId { get; set; }
-
-        /// <summary>
-        /// The application that made the request.
-        /// </summary>
-        public string Application { get; set; }
-
-        /// <summary>
-        /// The user that made the request.
-        /// </summary>
-        public string User { get; set; }
-
-        /// <summary>
-        /// The machine that made the request.
-        /// </summary>
-        public string Machine { get; set; }
-
-        /// <summary>
-        /// The IP address that made the request.
-        /// </summary>
-        public string RequestIpAddress { get; set; }
-
-        /// <summary>
-        /// The request content type.
-        /// </summary>
-        public string RequestContentType { get; set; }
-
-        /// <summary>
-        /// The request content body.
-        /// </summary>
-        public string RequestContentBody { get; set; }
-
-        /// <summary>
-        /// The request URI.
-        /// </summary>
-        public string RequestUri { get; set; }
-
-        /// <summary>
-        /// The request method (GET, POST, etc).
-        /// </summary>
-
-        public string RequestMethod { get; set; }
-
-        /// <summary>
-        /// // The request route template.
-        /// </summary>
-        public string RequestRouteTemplate { get; set; }
-
-        /// <summary>
-        /// // The request route data.
-        /// </summary>
-        public string RequestRouteData { get; set; }
-
-        /// <summary>
-        /// The request headers.
-        /// </summary>
-        public string RequestHeaders { get; set; }
-
-        /// <summary>
-        /// // The request timestamp.
-        /// </summary>
-        public DateTime? RequestTimestamp { get; set; }
-
-        /// <summary>
-        /// The response content type.
-        /// </summary>
-        public string ResponseContentType { get; set; }
-
-        /// <summary>
-        /// The response content body.
-        /// </summary>
-        public string ResponseContentBody { get; set; }
-
-        /// <summary>
-        /// The response status code.
-        /// </summary>
-        public int? ResponseStatusCode { get; set; }
-
-        /// <summary>
-        /// The response headers.
-        /// </summary>
-        public string ResponseHeaders { get; set; }
-
-        /// <summary>
-        /// The response timestamp.
-        /// </summary>
-        public DateTime? ResponseTimestamp { get; set; }
-
-        /// <summary>
-        /// 從server丟出去的請求
-        /// </summary>
-        public bool IsOutData { get; set; }
-
-        /// <summary>
-        /// 錯誤訊息
-        /// </summary>
-        public string ErrorMsg { get; set; }
-
-        /// <summary>
-        /// 錯誤時間
-        /// </summary>
-        public DateTime? ErrorOn { get; set; }
-    }
-}

+ 0 - 54
EVCB_OCPP.Domain/Models/Database/ConnectorMeterValueRecord.cs

@@ -1,54 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.DataAnnotations;
-using System.ComponentModel.DataAnnotations.Schema;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace EVCB_OCPP.Domain.Models.Database
-{
-    [Table("ConnectorMeterValueRecord")]
-    public class ConnectorMeterValueRecord
-    {
-
-        public ConnectorMeterValueRecord()
-        {
-            TransactionId = -1;
-        }
-        [Key]
-        public Int64 Id { set; get; }
-
-        [StringLength(50)]
-        public string ChargeBoxId { get; set; }
-
-        public byte ConnectorId { set; get; }
-
-        public int TransactionId { set; get; }
-
-        
-        public int ContextId { set; get; }
-
-    
-        public int FormatId { set; get; }
-
-       
-        public int MeasurandId{ set; get; }
-
-      
-        public int PhaseId { set; get; }
-
-       
-        public int LocationId { set; get; }
-
-        [StringLength(10)]
-        public string Value { set; get; }
-
-       
-        public int UnitId { set; get; }
-
-        public DateTime CreatedOn { set; get; }
-
-
-    }
-}

+ 0 - 64
EVCB_OCPP.Domain/Models/Database/ConnectorStatus.cs

@@ -1,64 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.DataAnnotations;
-using System.ComponentModel.DataAnnotations.Schema;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace EVCB_OCPP.Domain.Models.Database
-{
-    [Table("ConnectorStatus")]
-    public class ConnectorStatus
-    {
-
-        public ConnectorStatus()
-        {
-            ErrorInfo = string.Empty;
-            VendorId = string.Empty;
-            VendorErrorCode = string.Empty;
-
-        }
-        [Key]
-        [StringLength(36)]
-        public string Id { get; set; }
-
-        [StringLength(50)]
-        public string ChargeBoxId { get; set; }
-
-        public byte ConnectorId { set; get; }
-
-        public int Status { set; get; }
-
-        /// <summary>
-        /// errorCode
-        /// </summary>
-        public int ChargePointErrorCodeId { set; get; }
-
-        /// <summary>
-        ///ErrorInfo
-        /// </summary>
-        [StringLength(50)]
-        public string ErrorInfo { set; get; }
-
-        /// <summary>
-        /// vendorId
-        /// </summary>
-        [StringLength(255)]
-        public string VendorId { set; get; }
-
-        /// <summary>
-        /// vendorErrorCode
-        /// </summary>
-        [StringLength(100)]
-        public string VendorErrorCode { set; get; }
-
-        public DateTime CreatedOn { set; get; }
-
-        [DataType("decimal(10,2)")]
-        public decimal TotalEnergy { set; get; }
-
-        public int Type { set; get; }
-
-    }
-}

+ 0 - 132
EVCB_OCPP.Domain/Models/Database/Customer.cs

@@ -1,132 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.DataAnnotations;
-using System.ComponentModel.DataAnnotations.Schema;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace EVCB_OCPP.Domain.Models.Database
-{
-    /// <summary>
-    /// 未來會以充電站規模使用管理後台
-    /// </summary>
-    [Table("Customer")]
-    public class Customer
-    {
-        [Key]
-        public Guid Id { get; set; }
-
-        [StringLength(50)]
-        public string Name { get; set; }
-
-        public DateTime CreatedOn { get; set; }
-
-        [StringLength(50)]       
-        public string CreatedBy { get; set; }            
-
-          
-        public DateTime? Deadline { get; set; }
-
-      
-        public DateTime? UpdatedOn { get; set; }
-
-        [StringLength(50)]       
-        public string UpdatedBy { get; set; }     
-        
-
-        /// <summary>
-        /// 對方的api Url
-        /// </summary>
-        [StringLength(256)]
-        public string ApiUrl { get; set; }
-
-        /// <summary>
-        /// 對方的 api Key
-        /// </summary>
-        [StringLength(128)]
-        public string ApiKey { get; set; }
-
-        /// <summary>
-        /// api Key的更新日期
-        /// </summary>
-        public DateTime? ApiKeyUpdatedOn { get; set; }
-
-        /// <summary>
-        /// 呼叫對方 api的客戶代碼
-        /// </summary>
-        [StringLength(36)]
-        public string PartnerId { get; set; }
-
-        /// <summary>
-        /// 對方的 api Id
-        /// </summary>
-        [StringLength(36)]
-        public string ApiCustomerId { get; set; }
-
-     
-
-        /// <summary>
-        /// 排程呼掉對方的services
-        /// </summary>
-        public bool CallPartnerApiOnSchedule { get; set; }
-
-       
-
-        /// <summary>
-        /// 是否顯示
-        /// </summary>
-        public bool IsShow { get; set; }
-
-        /// <summary>
-        /// FTP 網址
-        /// </summary>
-        public string FTPPath { set; get; }
-
-
-        /// <summary>
-        /// FTP Host  ftp://user:password @host:port/path
-        /// </summary>
-        [StringLength(50)]
-        public string FTPHost { set; get; }
-
-        /// <summary>
-        /// FTP user
-        /// </summary>
-        [StringLength(20)]
-        public string FTPUser { set; get; }
-
-        /// <summary>
-        /// FTP password
-        /// </summary>
-        [StringLength(20)]
-        public string FTPPassword { set; get; }
-
-
-        public bool EnableTTIA { set; get; }
-
-        [StringLength(10)]
-        public string TTIA_EquipmentProvider { set; get; }
-
-        public int TTIA_CustomerId { set; get; }
-
-        [StringLength(100)]
-        public string TTIA_APIUrl { set; get; }
-
-        [StringLength(10)]
-        public string TTIA_APIKey { set; get; }
-
-
-        public bool InstantStopTxReport { set; get; }
-
-
-        public Customer()
-        {
-            Id = Guid.NewGuid();
-        }
-        
-       
-       
-
-    }
-}

+ 0 - 222
EVCB_OCPP.Domain/Models/Database/Machine.cs

@@ -1,222 +0,0 @@
-namespace EVCB_OCPP.Domain.Models.Database
-{
-    using Microsoft.EntityFrameworkCore;
-    using System;
-    using System.Collections.Generic;
-    using System.ComponentModel.DataAnnotations;
-    using System.ComponentModel.DataAnnotations.Schema;
-
-    /// <summary>
-    /// 樁的基本檔
-    /// </summary>
-    [Table("Machine")]
-    [Index(nameof(ChargeBoxId), IsUnique = true)]
-    public partial class Machine
-    {
-        public Machine()
-        {
-            Id = Guid.NewGuid().ToString();
-            ChargePointSerialNumber = string.Empty;
-            ChargeBoxSerialNumber = string.Empty;
-            ChargePointModel = string.Empty;
-            ChargePointVendor = string.Empty;
-            Iccid = string.Empty;
-            Imsi = string.Empty;
-            MeterType = string.Empty;
-            MeterSerialNumber = string.Empty;
-            CreatedBy = string.Empty;
-            Comment = string.Empty;
-            HeartbeatUpdatedOn = new DateTime(1991, 1, 1);
-        }
-
-        [Key]
-        [StringLength(36)]
-        public string Id { get; set; }
-
-        /// <summary>
-        /// ChargeBoxId
-        /// </summary>
-        [StringLength(50)]
-        public string ChargeBoxId { get; set; }
-
-        /// <summary>
-        /// chargePointSerialNumber
-        /// </summary>       
-        [StringLength(25)]
-        public string ChargePointSerialNumber { get; set; }
-
-        /// <summary>
-        /// chargeBoxSerialNumber
-        /// </summary>    
-        [StringLength(25)]
-        public string ChargeBoxSerialNumber { get; set; }
-
-
-
-        /// <summary>
-        /// chargePointModel
-        /// </summary>      
-        [StringLength(20)]
-        public string ChargePointModel { get; set; }
-
-        /// <summary>
-        /// chargePointVendor
-        /// </summary>
-        [StringLength(20)]
-        public string ChargePointVendor { get; set; }
-
-        /// <summary>
-        /// iccid
-        /// </summary>
-        [StringLength(20)]
-        public string Iccid { get; set; }
-
-
-        /// <summary>
-        /// imsi
-        /// </summary>
-        [StringLength(20)]
-        public string Imsi { get; set; }
-
-        /// <summary>
-        /// MeterType
-        /// </summary>
-        [StringLength(25)]
-        public string MeterType { get; set; }
-
-        /// <summary>
-        /// meterSerialNumber
-        /// </summary>
-        [StringLength(25)]
-        public string MeterSerialNumber { get; set; }
-
-
-        /// <summary>
-        /// 建立時間
-        /// </summary>       
-        public DateTime CreatedOn { get; set; }
-
-        /// <summary>
-        /// 建立者
-        /// </summary>
-        [StringLength(50)]
-        public string CreatedBy { get; set; }
-
-        /// <summary>
-        /// 描述
-        /// </summary>
-        [StringLength(100)]
-        public string Comment { get; set; }
-
-        /// <summary>
-        /// 客戶id
-        /// </summary>      
-        public Guid CustomerId { get; set; }
-
- 
-
-
-        /// <summary>
-        /// 充電槍個數
-        /// </summary>
-        public int GunAmt { get; set; }
-
-
-
-        /// <summary>
-        /// 心跳包更新時間
-        /// </summary>
-        public DateTime HeartbeatUpdatedOn { get; set; }
-
-        /// <summary>
-        /// 機器回報的韌體版本編號
-        /// </summary>
-        public int? FW_VersionReport { get; set; }
-
-
-        /// <summary>
-        /// 機器被指派的韌體版本編號
-        /// </summary>
-        public int? FW_AssignedVersion { get; set; }
-
-        /// <summary>
-        /// 是否在線
-        /// </summary>
-        public bool Online { get; set; }
-
-        /// <summary>
-        /// 電樁連線方式 
-        /// 0:unknown 
-        /// 1:1.6J with http  
-        /// 2:1.6J with https 
-        /// </summary>       
-        public int ConnectionType { get; set; }
-
-
-        [ForeignKey("CustomerId")]
-        public virtual Customer Customer { get; set; }
-
-
-        /// <summary>
-        /// 斷網時間
-        /// </summary>
-        public DateTime? OfflineOn { get; set; }
-
-        /// <summary>
-        /// firmwareVersion
-        /// </summary>
-        [StringLength(50)]
-        public string FW_CurrentVersion { get; set; }
-
-        [DataType("decimal(6 ,2)")]
-        public decimal RatedPower { set; get; }
-
-        /// <summary>
-        /// ConnectorType
-        /// </summary>
-        [StringLength(50)]
-        public string ConnectorType { get; set; }
-
-        /// <summary>
-        /// ConnectorPowerType
-        /// </summary>
-        [StringLength(50)]
-        public string ConnectorPowerType { get; set; }
-
-        [DataType("decimal(10 ,6)")]
-        public decimal Latitude { set; get; }
-
-        [DataType("decimal(10 ,6)")]
-        public decimal Longitude { set; get; }
-
-
-        /// <summary>
-        /// VendorId
-        /// </summary>
-        [StringLength(50)]
-        public string VendorId { get; set; }
-
-        /// <summary>
-        /// ModelName
-        /// </summary>
-        [StringLength(50)]
-        public string ModelName { get; set; }
-
-        /// <summary>
-        /// Board Versions
-        /// </summary>       
-        public string BoardVersions { get; set; }
-
-
-        public bool IsDelete { set; get; }
-
-        /// <summary>
-        /// TTIA樁號代號
-        /// </summary>
-        public int TTIATag { set; get; }
-
-
-
-
-    }
-}

+ 0 - 45
EVCB_OCPP.Domain/Models/Database/MachineConfiguration.cs

@@ -1,45 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.DataAnnotations;
-using System.ComponentModel.DataAnnotations.Schema;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace EVCB_OCPP.Domain.Models.Database
-{
-    public class MachineConfiguration
-    {
-        public MachineConfiguration()
-        {
-            Exists = false;
-            ReadOnly = true;
-            ConfigureSetting = string.Empty;
-
-
-        }
-
-        [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
-        [Key]
-        public Int32 Id { set; get; }
-
-        [StringLength(50)]
-        public string ChargeBoxId { get; set; }
-
-        /// <summary>
-        /// 電樁是否存在此設定值
-        /// </summary>
-        public bool Exists { set; get; }
-
-        /// <summary>
-        /// 存取限制 
-        /// </summary>
-        public bool ReadOnly { set; get; }
-
-        [StringLength(50)]
-        public string ConfigureName { set; get; }
-
-        [StringLength(500)]
-        public string ConfigureSetting { set; get; }
-    }
-}

+ 0 - 70
EVCB_OCPP.Domain/Models/Database/MachineConnectionLog.cs

@@ -1,70 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.ComponentModel.DataAnnotations;
-using System.ComponentModel.DataAnnotations.Schema;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace EVCB_OCPP.Domain.Models.Database
-{
-    [Table("MachineConnectionLog")]
-    public class MachineConnectionLog
-    {
-
-        public MachineConnectionLog()
-        {
-            IsSent = false;
-        }
-
-        public Int64 Id { set; get; }
-
-        [StringLength(50)]
-        public string ChargeBoxId { get; set; }
-
-
-
-        /// <summary>
-        /// 訊息種類
-        /// </summary>
-        [StringLength(50)]
-        public string MessageType { get; set; }
-
-        /// <summary>
-        /// 封包訊息
-        /// </summary>
-        [StringLength(3600)]      
-        public string Data { get; set; }
-
-        /// <summary>
-        /// 訊息,可放錯誤訊息
-        /// </summary>
-        [StringLength(200)]
-        [DefaultValue("")]
-        public string Msg { get; set; }
-
-        /// <summary>
-        /// 產生時間
-        /// </summary>       
-        public DateTime CreatedOn { get; set; }
-
-        /// <summary>
-        /// 傳出訊息
-        /// </summary>
-        public bool IsSent { set; get; }
-
-        /// <summary>
-        /// 電樁 EndPoint 
-        /// </summary>
-        [StringLength(25)]
-        public string EVSEEndPoint { get; set; }
-
-
-        /// <summary>
-        /// Session
-        /// </summary>
-        [StringLength(36)]
-        public string Session { get; set; }
-    }
-}

+ 0 - 70
EVCB_OCPP.Domain/Models/Database/MachineError.cs

@@ -1,70 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.DataAnnotations;
-using System.ComponentModel.DataAnnotations.Schema;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace EVCB_OCPP.Domain.Models.Database
-{
-    [Table("MachineError")]
-    public partial class MachineError
-    {
-        public MachineError()
-        {
-        }
-
-        [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
-        [Key]       
-        public int Id { get; set; }
-
-
-
-        [StringLength(50)]
-        public string ChargeBoxId { get; set; }
-
-        /// <summary>
-        /// 槍號
-        /// </summary>
-        public byte ConnectorId { get; set; }
-
-        /// <summary>
-        /// 先前的狀態
-        /// </summary>
-        public int PreStatus { get; set; }
-
-        /// <summary>
-        /// 錯誤的狀態
-        /// </summary>
-        public int Status { get; set; }
-
-        /// <summary>
-        /// 錯誤代碼Id
-        /// </summary>
-        public int ErrorCodeId { get; set; }
-
-        /// <summary>
-        ///ErrorInfo
-        /// </summary>
-        [StringLength(50)]
-        public string ErrorInfo { set; get; }
-
-        /// <summary>
-        /// vendorId
-        /// </summary>
-        [StringLength(255)]
-        public string VendorId { set; get; }
-
-        /// <summary>
-        /// vendorErrorCode
-        /// </summary>
-        [StringLength(100)]
-        public string VendorErrorCode { set; get; }
-
-
-
-        [Required]
-        public DateTime CreatedOn { get; set; }
-    }
-}

+ 0 - 100
EVCB_OCPP.Domain/Models/Database/MachineOperateRecord.cs

@@ -1,100 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.DataAnnotations;
-using System.ComponentModel.DataAnnotations.Schema;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace EVCB_OCPP.Domain.Models.Database
-{
-    /// <summary>
-    /// 電樁操作紀錄
-    /// </summary>
-    [Table("MachineOperateRecord")]
-    public class MachineOperateRecord
-    {
-
-        public MachineOperateRecord()
-        {
-            EVSE_Value = string.Empty;
-            FinishedOn = new DateTime(1991, 1, 1);
-            ReportedOn = new DateTime(1991, 1, 1);
-
-        }
-
-        [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
-        [Key]
-        public int Id { get; set; }
-
-        /// <summary>
-        ///Action
-        /// </summary>
-        [StringLength(30)]
-        public string Action { get; set; }
-
-
-        /// <summary>
-        /// 機器的客戶自訂ID
-        /// </summary>
-        [StringLength(50)]
-        public string ChargeBoxId { get; set; }
-
-
-
-        /// <summary>
-        /// 隨機序號 和ServerCommand是同一個組序號
-        /// </summary>
-        [StringLength(36)]
-        public string SerialNo { get; set; }
-
-        /// <summary>
-        /// 請求類型
-        /// </summary>     
-        public int RequestType { get; set; }
-
-
-        /// <summary>
-        /// 請求內容
-        /// </summary> 
-        public string RequestContent { get; set; }
-
-
-        /// <summary>
-        /// 狀態
-        /// </summary>     
-        public int Status { get; set; }
-
-        /// <summary>
-        /// EVSE回覆值
-        /// </summary>      
-        public string EVSE_Value { get; set; }
-        
-        /// <summary>
-        /// EVSE狀態
-        /// </summary>     
-        public int EVSE_Status { get; set; }
-
-        /// <summary>
-        /// 建立時間
-        /// </summary>
-        public DateTime CreatedOn { set; get; }
-
-
-        /// <summary>
-        /// 結束時間
-        /// </summary>
-        public DateTime FinishedOn { set; get; }
-
-
-        /// <summary>
-        /// 回報時間
-        /// </summary>
-        public DateTime ReportedOn { set; get; }
-
-
-     
-
-
-    }
-}

+ 0 - 39
EVCB_OCPP.Domain/Models/Database/MachineVersionFile.cs

@@ -1,39 +0,0 @@
-namespace EVCB_OCPP.Domain.Models.Database
-{
-    using System;
-    using System.Collections.Generic;
-    using System.ComponentModel;
-    using System.ComponentModel.DataAnnotations;
-    using System.ComponentModel.DataAnnotations.Schema;
-
-    /// <summary>
-    /// 機器的版本發佈的檔案關連
-    /// </summary>
-    [Table("MachineVersionFile")]
-    public partial class MachineVersionFile
-    {
-        [Key]
-        public int Id { get; set; }
-      
-        [Required]
-        public DateTime CreatedOn { get; set; }
-
-
-
-        [StringLength(50)]
-        public string ChargeBoxId { get; set; }
-
-        [Required]
-        public string UploadFileId { get; set; }
-
-
-        /// <summary>
-        /// 排序
-        /// </summary>
-        public int Seq { get; set; }
-      
-
-        [ForeignKey("UploadFileId")]
-        public virtual UploadFile UploadFile { get; set; }
-    }
-}

+ 0 - 28
EVCB_OCPP.Domain/Models/Database/OCMF.cs

@@ -1,28 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.DataAnnotations;
-using System.ComponentModel.DataAnnotations.Schema;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace EVCB_OCPP.Domain.Models.Database
-{
-    [Table("OCMF")]
-    public class OCMF
-    {
-        [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
-        [Key]
-        public Int32 Id { get; set; }
-
-
-        public Int32 TransactionId { get; set; }
-
-
-        [StringLength(2048)]
-        public string DataString { set; get; }
-
-        [StringLength(256)]
-        public string PublicKey { set; get; }
-    }
-}

+ 0 - 75
EVCB_OCPP.Domain/Models/Database/ServerMessage.cs

@@ -1,75 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.ComponentModel.DataAnnotations;
-using System.ComponentModel.DataAnnotations.Schema;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace EVCB_OCPP.Domain.Models.Database
-{
-    /// <summary>
-    /// 需確認的指令發送檔
-    /// </summary>
-    [Table("ServerMessage")]
-    public partial class ServerMessage
-    {
-        public ServerMessage()
-        {
-            ReceivedOn = new DateTime(1991, 1, 1);
-            UpdatedOn = new DateTime(1991, 1, 1);
-        }
-
-        [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
-        [Key]
-        public int Id { get; set; }
-
-
-        /// <summary>
-        /// 機器的客戶自訂ID
-        /// </summary>
-        [StringLength(50)]
-        public string ChargeBoxId { get; set; }
-
-        /// <summary>
-        /// 隨機序號
-        /// </summary>
-        [StringLength(36)]
-        public string SerialNo { get; set; }
-
-
-        /// <summary>
-        /// 輸入傳送Action
-        /// </summary>
-        [StringLength(30)]
-        public string OutAction { get; set; }
-
-        /// <summary>
-        /// 輸入傳送資料
-        /// </summary>
-        public string OutRequest { get; set; }
-
-        /// <summary>
-        /// 收到傳送資料
-        /// </summary>      
-        public string InMessage { get; set; }
-
-
-        public DateTime CreatedOn { get; set; }
-
-        [StringLength(36)]
-        public string CreatedBy { get; set; }
-
-        /// <summary>
-        /// 更新輸入指令
-        /// </summary>
-        public DateTime UpdatedOn { get; set; }
-
-
-        /// <summary>
-        /// 收到輸入指令
-        /// </summary>
-        public DateTime ReceivedOn { get; set; }
-    }
-}

+ 0 - 52
EVCB_OCPP.Domain/Models/Database/TransactionDataRecord.cs

@@ -1,52 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.DataAnnotations;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace EVCB_OCPP.Domain.Models.Database
-{
-    public class TransactionDataRecord
-    {
-        [Key]
-        public Int64 Id { set; get; }
-
-        public byte ConnectorId { get; set; }
-
-        /// <summary>
-        /// TransactionId
-        /// </summary>       
-        public int TransactionId { get; set; }
-
-        /// <summary>
-        /// chargePointSerialNumber
-        /// </summary>       
-        [StringLength(50)]
-        public string ChargeBoxId { get; set; }
-
-
-        public int ContextId { set; get; }
-
-
-        public int FormatId { set; get; }
-
-
-        public int MeasurandId { set; get; }
-
-
-        public int PhaseId { set; get; }
-
-
-        public int LocationId { set; get; }
-
-        [StringLength(10)]
-        public string Value { set; get; }
-
-
-        public int UnitId { set; get; }
-
-
-        public DateTime MeasuredOn { set; get; }
-    }
-}

+ 0 - 181
EVCB_OCPP.Domain/Models/Database/TransactionRecord.cs

@@ -1,181 +0,0 @@
-namespace EVCB_OCPP.Domain.Models.Database
-{
-    using Microsoft.EntityFrameworkCore;
-    using System;
-    using System.Collections.Generic;
-    using System.ComponentModel;
-    using System.ComponentModel.DataAnnotations;
-    using System.ComponentModel.DataAnnotations.Schema;
-
-    /// <summary>
-    /// 交易紀錄
-    /// </summary>
-    [Table("TransactionRecord")]
-    [Index(nameof(ConnectorId), nameof(ChargeBoxId), nameof(StartTime) , IsUnique = true)]
-    public partial class TransactionRecord
-    {
-        public TransactionRecord()
-        {
-            StartIdTag = string.Empty;
-            StopIdTag = string.Empty;
-            StartTime = new DateTime(1991, 1, 1);
-            StopTime = new DateTime(1991, 1, 1);
-            ReservationId = -1;
-            BillingDone = false;
-            CreatedOn = new DateTime(1991, 1, 1);
-            UpdatedOn = new DateTime(1991, 1, 1);
-            StartTransactionReportedOn = new DateTime(1991, 1, 1);
-            StopTransactionReportedOn = new DateTime(1991, 1, 1);
-            ErrorMsg = string.Empty;
-        }
-
-        [Key]
-        public Int32 Id { get; set; }
-
-        /// <summary>
-        /// 客戶代碼
-        /// </summary>
-        [Required]
-        public Guid CustomerId { get; set; }
-
-
-
-        /// <summary>
-        /// 槍號  1 byte string、本來是 string、改為byte
-        /// </summary>
-        [Required]
-        //[Index("IX_1202_Issue_Report", Order = 2, IsUnique = true)]
-        public byte ConnectorId { get; set; }
-
-
-
-        /// <summary>
-        /// chargePointSerialNumber
-        /// </summary>
-        //[Index("IX_MachineId")]
-        //[Index("IX_1202_Issue_Report", Order = 1, IsUnique = true)]
-        [Required]
-        [StringLength(50)]
-        public string ChargeBoxId { get; set; }
-
-        /// <summary>
-        /// StartIdTag
-        /// </summary>
-        [StringLength(20)]
-        public string StartIdTag { get; set; }
-
-
-        /// <summary>
-        /// StopIdTag
-        /// </summary>
-        [StringLength(20)]
-        public string StopIdTag { get; set; }
-
-        /// <summary>
-        /// 開始充電開始時間
-        /// </summary>
-        //[Index("IX_1202_Issue_Report", Order = 3, IsUnique = true)]
-        public DateTime StartTime { get; set; }
-
-        /// <summary>
-        /// 充電結束時間
-        /// </summary>
-        public DateTime StopTime { get; set; }
-
-        /// <summary>
-        /// 預約Id
-        /// </summary>
-        public int ReservationId { set; get; }
-
-        /// <summary>
-        /// 停止原因No
-        /// </summary>
-        public int StopReasonId { set; get; }
-
-        /// <summary>
-        /// 停止原因
-        /// </summary>
-        [StringLength(60)]
-        public string StopReason { set; get; }
-
-
-
-        /// <summary>
-        /// 開始meter
-        /// </summary>
-        [DataType("decimal(16 ,2)")]
-        public decimal MeterStart { get; set; }
-
-        /// <summary>
-        /// 結束meter
-        /// </summary>
-        [DataType("decimal(16 ,2)")]
-        public decimal MeterStop { get; set; }
-
-        /// <summary>
-        /// 產生時間
-        /// </summary>
-        public DateTime CreatedOn { get; set; }
-
-        /// <summary>
-        /// 更新時間
-        /// </summary>
-        public DateTime UpdatedOn { get; set; }
-
-
-        /// <summary>
-        /// 開始充電的回報時間
-        /// </summary>
-        public DateTime StartTransactionReportedOn { get; set; }
-
-        /// <summary>
-        /// 開始充電回報的次數
-        /// </summary>
-        public int RetryStartTransactionTimes { get; set; }
-
-        /// <summary>
-        /// 結束充電的回報時間
-        /// </summary>
-        public DateTime StopTransactionReportedOn { get; set; }
-
-        /// <summary>
-        /// 結束充電回報的次數
-        /// </summary>
-        public int RetryStopTransactionTimes { get; set; }
-
-        /// <summary>
-        /// 回調客戶API,問題紀錄
-        /// </summary>
-        public string ErrorMsg { set; get; }
-
-        /// <summary>
-        /// 計費完成與否
-        /// </summary>
-        public bool BillingDone { set; get; }
-
-        /// <summary>
-        /// 是否上傳到TTIA
-        /// </summary>
-        public bool UploadedtoTTIA { set; get; }
-
-        [DataType("decimal(16 ,2)")]
-        public decimal Cost { set; get; }
-
-        /// <summary>
-        /// 收費明細
-        /// </summary>
-        [StringLength(3000)]
-        public string Receipt { set; get; }
-
-        /// <summary>
-        /// 收費標準
-        /// </summary>
-        [StringLength(1500)]
-        public string Fee { set; get; }
-
-
-
-
-
-    }
-}

+ 0 - 101
EVCB_OCPP.Domain/Models/Database/UploadFile.cs

@@ -1,101 +0,0 @@
-namespace EVCB_OCPP.Domain.Models.Database
-{
-    using System;
-    using System.Collections.Generic;
-    using System.ComponentModel.DataAnnotations;
-    using System.ComponentModel.DataAnnotations.Schema;
-
-    /// <summary>
-    /// 上傳檔案
-    /// </summary>
-    [Table("UploadFile")]
-    public partial class UploadFile
-    {
-        public UploadFile()
-        {
-            Id = Guid.NewGuid().ToString();
-        }
-
-        //[Index(IsClustered = false)]
-        [StringLength(36)]
-        public string Id { get; set; }
-
-        /// <summary>
-        /// 檔名
-        /// </summary>
-        [Required]
-        [StringLength(500)]    
-        public string FileName { get; set; }
-
-        /// <summary>
-        /// 原始檔名
-        /// </summary>
-        [Required]
-        [StringLength(500)]       
-        public string OriginName { get; set; }
-
-       
-        public int FileSize { get; set; }
-
-        /// <summary>
-        /// 檔案類型
-        /// </summary>
-        [StringLength(200)]     
-        public string FileType { get; set; }
-
-        /// <summary>
-        /// 副檔名
-        /// </summary>
-        [StringLength(50)]    
-        public string FileExtensionName { get; set; }
-
-        /// <summary>
-        /// 檔案路徑
-        /// </summary>
-        [Required]
-        [StringLength(500)]       
-        public string FilePath { get; set; }
-
-        
-        public DateTime CreatedOn { get; set; }
-
-        [StringLength(50)]      
-        public string CreatedBy { get; set; }      
-      
-
-        /// <summary>
-        /// MD5
-        /// </summary>
-        [StringLength(50)]
-        public string FileMD5 { get; set; }
-
-        /// <summary>
-        /// 網頁路徑
-        /// </summary>
-        [StringLength(512)]
-        public string FileUrl { get; set; }
-
-        /// <summary>
-        /// VendorId
-        /// </summary>
-        [StringLength(50)]
-        [Required]
-        public string VendorId { get; set; }
-
-
-        /// <summary>
-        /// ModelName
-        /// </summary>
-        [StringLength(50)]
-        [Required]
-        public string ModelName { get; set; }
-
-        /// <summary>
-        /// ModuleId
-        /// </summary>  
-        [Required]
-        public int ModuleId { get; set; }
-
-
-    }
-}

+ 31 - 0
EVCB_OCPP.Domain/Models/MainDb/ConnectorMeterValueRecord.cs

@@ -0,0 +1,31 @@
+using System;
+using System.Collections.Generic;
+
+namespace EVCB_OCPP.Domain.Models.MainDb;
+
+public partial class ConnectorMeterValueRecord
+{
+    public long Id { get; set; }
+
+    public byte ConnectorId { get; set; }
+
+    public string Value { get; set; }
+
+    public DateTime CreatedOn { get; set; }
+
+    public int ContextId { get; set; }
+
+    public int FormatId { get; set; }
+
+    public int MeasurandId { get; set; }
+
+    public int PhaseId { get; set; }
+
+    public int LocationId { get; set; }
+
+    public int UnitId { get; set; }
+
+    public string ChargeBoxId { get; set; }
+
+    public int TransactionId { get; set; }
+}

+ 29 - 0
EVCB_OCPP.Domain/Models/MainDb/ConnectorStatus.cs

@@ -0,0 +1,29 @@
+using System;
+using System.Collections.Generic;
+
+namespace EVCB_OCPP.Domain.Models.MainDb;
+
+public partial class ConnectorStatus
+{
+    public string Id { get; set; }
+
+    public byte ConnectorId { get; set; }
+
+    public int Status { get; set; }
+
+    public string ErrorInfo { get; set; }
+
+    public string VendorId { get; set; }
+
+    public DateTime CreatedOn { get; set; }
+
+    public string VendorErrorCode { get; set; }
+
+    public int ChargePointErrorCodeId { get; set; }
+
+    public string ChargeBoxId { get; set; }
+
+    public decimal TotalEnergy { get; set; }
+
+    public int Type { get; set; }
+}

+ 57 - 0
EVCB_OCPP.Domain/Models/MainDb/Customer.cs

@@ -0,0 +1,57 @@
+using System;
+using System.Collections.Generic;
+
+namespace EVCB_OCPP.Domain.Models.MainDb;
+
+public partial class Customer
+{
+    public Guid Id { get; set; }
+
+    public string Name { get; set; }
+
+    public DateTime CreatedOn { get; set; }
+
+    public string CreatedBy { get; set; }
+
+    public DateTime? Deadline { get; set; }
+
+    public DateTime? UpdatedOn { get; set; }
+
+    public string UpdatedBy { get; set; }
+
+    public string ApiUrl { get; set; }
+
+    public string ApiKey { get; set; }
+
+    public DateTime? ApiKeyUpdatedOn { get; set; }
+
+    public string PartnerId { get; set; }
+
+    public string ApiCustomerId { get; set; }
+
+    public bool CallPartnerApiOnSchedule { get; set; }
+
+    public bool IsShow { get; set; }
+
+    public string Ftppath { get; set; }
+
+    public string Ftphost { get; set; }
+
+    public string Ftpuser { get; set; }
+
+    public string Ftppassword { get; set; }
+
+    public bool EnableTtia { get; set; }
+
+    public string TtiaEquipmentProvider { get; set; }
+
+    public int TtiaCustomerId { get; set; }
+
+    public string TtiaApiurl { get; set; }
+
+    public string TtiaApikey { get; set; }
+
+    public bool InstantStopTxReport { get; set; }
+
+    public virtual ICollection<Machine> Machines { get; set; } = new List<Machine>();
+}

+ 19 - 0
EVCB_OCPP.Domain/Models/MainDb/LoadingBalance.cs

@@ -0,0 +1,19 @@
+using System;
+using System.Collections.Generic;
+
+namespace EVCB_OCPP.Domain.Models.MainDb;
+
+public partial class LoadingBalance
+{
+    public long Id { get; set; }
+
+    public int StationId { get; set; }
+
+    public string MachineId { get; set; }
+
+    public decimal Power { get; set; }
+
+    public DateTime CreatedOn { get; set; }
+
+    public DateTime FinishedOn { get; set; }
+}

+ 73 - 0
EVCB_OCPP.Domain/Models/MainDb/Machine.cs

@@ -0,0 +1,73 @@
+using System;
+using System.Collections.Generic;
+
+namespace EVCB_OCPP.Domain.Models.MainDb;
+
+public partial class Machine
+{
+    public string Id { get; set; }
+
+    public string ChargePointSerialNumber { get; set; }
+
+    public string ChargeBoxSerialNumber { get; set; }
+
+    public string ChargePointModel { get; set; }
+
+    public string ChargePointVendor { get; set; }
+
+    public string Iccid { get; set; }
+
+    public string Imsi { get; set; }
+
+    public string MeterType { get; set; }
+
+    public string MeterSerialNumber { get; set; }
+
+    public DateTime CreatedOn { get; set; }
+
+    public string CreatedBy { get; set; }
+
+    public string Comment { get; set; }
+
+    public Guid CustomerId { get; set; }
+
+    public int GunAmt { get; set; }
+
+    public DateTime HeartbeatUpdatedOn { get; set; }
+
+    public int? FwVersionReport { get; set; }
+
+    public int? FwAssignedVersion { get; set; }
+
+    public bool Online { get; set; }
+
+    public DateTime? OfflineOn { get; set; }
+
+    public string FwCurrentVersion { get; set; }
+
+    public string ChargeBoxId { get; set; }
+
+    public int ConnectionType { get; set; }
+
+    public decimal RatedPower { get; set; }
+
+    public string ConnectorType { get; set; }
+
+    public string ConnectorPowerType { get; set; }
+
+    public decimal Latitude { get; set; }
+
+    public decimal Longitude { get; set; }
+
+    public string VendorId { get; set; }
+
+    public string ModelName { get; set; }
+
+    public string BoardVersions { get; set; }
+
+    public bool IsDelete { get; set; }
+
+    public int Ttiatag { get; set; }
+
+    public virtual Customer Customer { get; set; }
+}

+ 19 - 0
EVCB_OCPP.Domain/Models/MainDb/MachineConfiguration.cs

@@ -0,0 +1,19 @@
+using System;
+using System.Collections.Generic;
+
+namespace EVCB_OCPP.Domain.Models.MainDb;
+
+public partial class MachineConfiguration
+{
+    public int Id { get; set; }
+
+    public string ConfigureName { get; set; }
+
+    public string ConfigureSetting { get; set; }
+
+    public bool ReadOnly { get; set; }
+
+    public string ChargeBoxId { get; set; }
+
+    public bool Exists { get; set; }
+}

+ 27 - 0
EVCB_OCPP.Domain/Models/MainDb/MachineError.cs

@@ -0,0 +1,27 @@
+using System;
+using System.Collections.Generic;
+
+namespace EVCB_OCPP.Domain.Models.MainDb;
+
+public partial class MachineError
+{
+    public int Id { get; set; }
+
+    public byte ConnectorId { get; set; }
+
+    public int PreStatus { get; set; }
+
+    public int Status { get; set; }
+
+    public string ErrorInfo { get; set; }
+
+    public string VendorId { get; set; }
+
+    public DateTime CreatedOn { get; set; }
+
+    public int ErrorCodeId { get; set; }
+
+    public string VendorErrorCode { get; set; }
+
+    public string ChargeBoxId { get; set; }
+}

+ 31 - 0
EVCB_OCPP.Domain/Models/MainDb/MachineOperateRecord.cs

@@ -0,0 +1,31 @@
+using System;
+using System.Collections.Generic;
+
+namespace EVCB_OCPP.Domain.Models.MainDb;
+
+public partial class MachineOperateRecord
+{
+    public int Id { get; set; }
+
+    public string SerialNo { get; set; }
+
+    public int RequestType { get; set; }
+
+    public string RequestContent { get; set; }
+
+    public int Status { get; set; }
+
+    public DateTime CreatedOn { get; set; }
+
+    public DateTime FinishedOn { get; set; }
+
+    public string EvseValue { get; set; }
+
+    public int EvseStatus { get; set; }
+
+    public string ChargeBoxId { get; set; }
+
+    public string Action { get; set; }
+
+    public DateTime ReportedOn { get; set; }
+}

+ 19 - 0
EVCB_OCPP.Domain/Models/MainDb/MachineVersionFile.cs

@@ -0,0 +1,19 @@
+using System;
+using System.Collections.Generic;
+
+namespace EVCB_OCPP.Domain.Models.MainDb;
+
+public partial class MachineVersionFile
+{
+    public int Id { get; set; }
+
+    public DateTime CreatedOn { get; set; }
+
+    public string UploadFileId { get; set; }
+
+    public int Seq { get; set; }
+
+    public string ChargeBoxId { get; set; }
+
+    public virtual UploadFile UploadFile { get; set; }
+}

+ 15 - 0
EVCB_OCPP.Domain/Models/MainDb/MigrationHistory.cs

@@ -0,0 +1,15 @@
+using System;
+using System.Collections.Generic;
+
+namespace EVCB_OCPP.Domain.Models.MainDb;
+
+public partial class MigrationHistory
+{
+    public string MigrationId { get; set; }
+
+    public string ContextKey { get; set; }
+
+    public byte[] Model { get; set; }
+
+    public string ProductVersion { get; set; }
+}

+ 15 - 0
EVCB_OCPP.Domain/Models/MainDb/Ocmf.cs

@@ -0,0 +1,15 @@
+using System;
+using System.Collections.Generic;
+
+namespace EVCB_OCPP.Domain.Models.MainDb;
+
+public partial class Ocmf
+{
+    public int Id { get; set; }
+
+    public int TransactionId { get; set; }
+
+    public string DataString { get; set; }
+
+    public string PublicKey { get; set; }
+}

+ 27 - 0
EVCB_OCPP.Domain/Models/MainDb/ServerMessage.cs

@@ -0,0 +1,27 @@
+using System;
+using System.Collections.Generic;
+
+namespace EVCB_OCPP.Domain.Models.MainDb;
+
+public partial class ServerMessage
+{
+    public int Id { get; set; }
+
+    public string SerialNo { get; set; }
+
+    public string OutAction { get; set; }
+
+    public string OutRequest { get; set; }
+
+    public string InMessage { get; set; }
+
+    public DateTime CreatedOn { get; set; }
+
+    public string CreatedBy { get; set; }
+
+    public DateTime ReceivedOn { get; set; }
+
+    public string ChargeBoxId { get; set; }
+
+    public DateTime UpdatedOn { get; set; }
+}

+ 65 - 0
EVCB_OCPP.Domain/Models/MainDb/TransactionRecord.cs

@@ -0,0 +1,65 @@
+using System;
+using System.Collections.Generic;
+
+namespace EVCB_OCPP.Domain.Models.MainDb;
+
+public partial class TransactionRecord
+{
+    public int Id { get; set; }
+
+    public DateTime StartTime { get; set; }
+
+    public DateTime StopTime { get; set; }
+
+    public Guid CustomerId { get; set; }
+
+    public byte ConnectorId { get; set; }
+
+    public decimal MeterStart { get; set; }
+
+    public decimal MeterStop { get; set; }
+
+    public DateTime CreatedOn { get; set; }
+
+    public DateTime UpdatedOn { get; set; }
+
+    public DateTime StartTransactionReportedOn { get; set; }
+
+    public int RetryStartTransactionTimes { get; set; }
+
+    public DateTime StopTransactionReportedOn { get; set; }
+
+    public string ErrorMsg { get; set; }
+
+    public string StartIdTag { get; set; }
+
+    public string StopIdTag { get; set; }
+
+    public int ReservationId { get; set; }
+
+    public int StopReasonId { get; set; }
+
+    public string ChargeBoxId { get; set; }
+
+    public int RetryStopTransactionTimes { get; set; }
+
+    public bool UploadedtoTtia { get; set; }
+
+    public decimal Cost { get; set; }
+
+    public string Fee { get; set; }
+
+    public string Receipt { get; set; }
+
+    public bool BillingDone { get; set; }
+
+    public string StopReason { get; set; }
+
+    public string StartSoc { get; set; }
+
+    public string StopSoc { get; set; }
+
+    public bool NotifyPnC { get; set; }
+
+    public string Evccid { get; set; }
+}

+ 37 - 0
EVCB_OCPP.Domain/Models/MainDb/UploadFile.cs

@@ -0,0 +1,37 @@
+using System;
+using System.Collections.Generic;
+
+namespace EVCB_OCPP.Domain.Models.MainDb;
+
+public partial class UploadFile
+{
+    public string Id { get; set; }
+
+    public string FileName { get; set; }
+
+    public string OriginName { get; set; }
+
+    public int FileSize { get; set; }
+
+    public string FileType { get; set; }
+
+    public string FileExtensionName { get; set; }
+
+    public string FilePath { get; set; }
+
+    public DateTime CreatedOn { get; set; }
+
+    public string CreatedBy { get; set; }
+
+    public string FileMd5 { get; set; }
+
+    public string FileUrl { get; set; }
+
+    public string VendorId { get; set; }
+
+    public string ModelName { get; set; }
+
+    public int ModuleId { get; set; }
+
+    public virtual ICollection<MachineVersionFile> MachineVersionFiles { get; set; } = new List<MachineVersionFile>();
+}

+ 29 - 0
EVCB_OCPP.Domain/Models/MainDb/VConnectorStatus.cs

@@ -0,0 +1,29 @@
+using System;
+using System.Collections.Generic;
+
+namespace EVCB_OCPP.Domain.Models.MainDb;
+
+public partial class VConnectorStatus
+{
+    public string Id { get; set; }
+
+    public byte ConnectorId { get; set; }
+
+    public int Status { get; set; }
+
+    public string ErrorInfo { get; set; }
+
+    public string VendorId { get; set; }
+
+    public DateTime CreatedOn { get; set; }
+
+    public string VendorErrorCode { get; set; }
+
+    public int ChargePointErrorCodeId { get; set; }
+
+    public string ChargeBoxId { get; set; }
+
+    public decimal TotalEnergy { get; set; }
+
+    public int Type { get; set; }
+}

+ 23 - 0
EVCB_OCPP.Domain/Models/MainDb/VConnectorStatusCombind.cs

@@ -0,0 +1,23 @@
+using System;
+using System.Collections.Generic;
+
+namespace EVCB_OCPP.Domain.Models.MainDb;
+
+public partial class VConnectorStatusCombind
+{
+    public string ChargeBoxId { get; set; }
+
+    public byte ConnectorId { get; set; }
+
+    public int Status { get; set; }
+
+    public int Type { get; set; }
+
+    public string VendorErrorCode { get; set; }
+
+    public int ChargePointErrorCodeId { get; set; }
+
+    public decimal TotalEnergy { get; set; }
+
+    public string Ocpp { get; set; }
+}

+ 35 - 0
EVCB_OCPP.Domain/Models/MainDb/VMachine.cs

@@ -0,0 +1,35 @@
+using System;
+using System.Collections.Generic;
+
+namespace EVCB_OCPP.Domain.Models.MainDb;
+
+public partial class VMachine
+{
+    public string Id { get; set; }
+
+    public string ChargeBoxId { get; set; }
+
+    public Guid CustomerId { get; set; }
+
+    public int GunAmt { get; set; }
+
+    public bool Online { get; set; }
+
+    public decimal RatedPower { get; set; }
+
+    public int ConnectionType { get; set; }
+
+    public DateTime HeartbeatUpdatedOn { get; set; }
+
+    public DateTime? OfflineOn { get; set; }
+
+    public string ConnectorType { get; set; }
+
+    public string VendorId { get; set; }
+
+    public string ModelName { get; set; }
+
+    public bool IsDelete { get; set; }
+
+    public int Ttiatag { get; set; }
+}

+ 37 - 0
EVCB_OCPP.Domain/Models/MainDb/VMachineCombind.cs

@@ -0,0 +1,37 @@
+using System;
+using System.Collections.Generic;
+
+namespace EVCB_OCPP.Domain.Models.MainDb;
+
+public partial class VMachineCombind
+{
+    public string Id { get; set; }
+
+    public string ChargeBoxId { get; set; }
+
+    public Guid CustomerId { get; set; }
+
+    public int GunAmt { get; set; }
+
+    public bool Online { get; set; }
+
+    public decimal RatedPower { get; set; }
+
+    public int ConnectionType { get; set; }
+
+    public DateTime HeartbeatUpdatedOn { get; set; }
+
+    public DateTime? OfflineOn { get; set; }
+
+    public string ConnectorType { get; set; }
+
+    public string VendorId { get; set; }
+
+    public string ModelName { get; set; }
+
+    public bool IsDelete { get; set; }
+
+    public int Ttiatag { get; set; }
+
+    public string Ocpp { get; set; }
+}

+ 31 - 0
EVCB_OCPP.Domain/Models/MeterValueDb/ConnectorMeterValueRecord.cs

@@ -0,0 +1,31 @@
+using System;
+using System.Collections.Generic;
+
+namespace EVCB_OCPP.Domain.Models.MeterValueDb;
+
+public partial class ConnectorMeterValueRecord
+{
+    public long Id { get; set; }
+
+    public byte ConnectorId { get; set; }
+
+    public string Value { get; set; }
+
+    public DateTime CreatedOn { get; set; }
+
+    public int ContextId { get; set; }
+
+    public int FormatId { get; set; }
+
+    public int MeasurandId { get; set; }
+
+    public int PhaseId { get; set; }
+
+    public int LocationId { get; set; }
+
+    public int UnitId { get; set; }
+
+    public string ChargeBoxId { get; set; }
+
+    public int TransactionId { get; set; }
+}

+ 1 - 1
EVCB_OCPP.Domain/Properties/AssemblyInfo.cs

@@ -35,4 +35,4 @@ using System.Runtime.InteropServices;
 [assembly: AssemblyVersion("0.1.0.0")]
 [assembly: AssemblyFileVersion("0.1.0.0")]
 
-[assembly: AssemblyInformationalVersion("f594000")]
+[assembly: AssemblyInformationalVersion("8b9cd1d")]

+ 1 - 1
EVCB_OCPP.MailService/Properties/AssemblyInfo.cs

@@ -35,4 +35,4 @@ using System.Runtime.InteropServices;
 [assembly: AssemblyVersion("0.1.0.0")]
 [assembly: AssemblyFileVersion("0.1.0.0")]
 
-[assembly: AssemblyInformationalVersion("f594000")]
+[assembly: AssemblyInformationalVersion("8b9cd1d")]

+ 1 - 1
EVCB_OCPP.Packet/Properties/AssemblyInfo.cs

@@ -35,4 +35,4 @@ using System.Runtime.InteropServices;
 [assembly: AssemblyVersion("0.1.0.0")]
 [assembly: AssemblyFileVersion("0.1.0.0")]
 
-[assembly: AssemblyInformationalVersion("f594000")]
+[assembly: AssemblyInformationalVersion("8b9cd1d")]

+ 1 - 1
EVCB_OCPP.Packet20/Properties/AssemblyInfo.cs

@@ -33,4 +33,4 @@ using System.Runtime.InteropServices;
 // [assembly: AssemblyVersion("0.1.0.0")]
 [assembly: AssemblyVersion("0.1.0.0")]
 [assembly: AssemblyFileVersion("0.1.0.0")]
-[assembly: AssemblyInformationalVersion("f594000")]
+[assembly: AssemblyInformationalVersion("8b9cd1d")]

+ 22 - 0
migration_commands.txt

@@ -0,0 +1,22 @@
+dotnet ef dbcontext scaffold --project ./EVCB_OCPP.Domain/EVCB_OCPP.Domain.csproj "data source=zerova-ev-dev.database.windows.net;initial catalog=StandardOCPP_ConnectionLog;persist security info=True;user id=azdevsoftware;password=1h52dev#az;MultipleActiveResultSets=True;App=EntityFramework" Microsoft.EntityFrameworkCore.SqlServer
+
+dotnet ef dbcontext scaffold --project ./EVCB_OCPP.Domain/EVCB_OCPP.Domain.csproj "data source=zerova-ev-dev.database.windows.net;initial catalog=StandardOCPP_Main;persist security info=True;user id=azdevsoftware;password=1h52dev#az;MultipleActiveResultSets=True;App=EntityFramework" Microsoft.EntityFrameworkCore.SqlServer --output-dir "./Models/MainDb" --context-dir "./"
+
+
+dotnet ef dbcontext scaffold --project ./EVCB_OCPP.Domain/EVCB_OCPP.Domain.csproj "data source=zerova-ev-dev.database.windows.net;initial catalog=StandardOCPP_MeterValue;persist security info=True;user id=azdevsoftware;password=1h52dev#az;MultipleActiveResultSets=True;App=EntityFramework" Microsoft.EntityFrameworkCore.SqlServer --output-dir "./Models/MeterValueDb" --context-dir "./"
+
+dotnet ef dbcontext scaffold --project ./EVCB_OCPP.Domain/EVCB_OCPP.Domain.csproj "data source=zerova-ev-dev.database.windows.net;initial catalog=StandardOCPP_ConnectionLog;persist security info=True;user id=azdevsoftware;password=1h52dev#az;MultipleActiveResultSets=True;App=EntityFramework" Microsoft.EntityFrameworkCore.SqlServer --output-dir "./Models/ConnectionLogDB" --context-dir "./"
+
+dotnet ef migrations add InitialCreate --project ./EVCB_OCPP.Domain/EVCB_OCPP.Domain.csproj --context MainDBContext
+
+dotnet ef migrations list --project ./EVCB_OCPP.Domain/EVCB_OCPP.Domain.csproj --context MainDBContext
+
+dotnet ef database update --project ./EVCB_OCPP.Domain/EVCB_OCPP.Domain.csproj --context MainDBContext
+
+dotnet ef migrations add InitialCreate --project ./EVCB_OCPP.Domain/EVCB_OCPP.Domain.csproj --context MeterValueDBContext
+
+dotnet ef database update --project ./EVCB_OCPP.Domain/EVCB_OCPP.Domain.csproj --context MeterValueDBContext
+
+dotnet ef migrations add InitialCreate --project ./EVCB_OCPP.Domain/EVCB_OCPP.Domain.csproj --context ConnectionLogDBContext
+
+dotnet ef database update --project ./EVCB_OCPP.Domain/EVCB_OCPP.Domain.csproj --context ConnectionLogDBContext