ConnectionLogDBContext.cs 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. using System;
  2. using System.Collections.Generic;
  3. using EVCB_OCPP.Domain.Models.ConnectionLogDB;
  4. using Microsoft.EntityFrameworkCore;
  5. namespace EVCB_OCPP.Domain;
  6. public partial class ConnectionLogDBContext : DbContext
  7. {
  8. public ConnectionLogDBContext()
  9. {
  10. }
  11. public ConnectionLogDBContext(DbContextOptions<ConnectionLogDBContext> options)
  12. : base(options)
  13. {
  14. }
  15. public virtual DbSet<MachineConnectionLog> MachineConnectionLogs { get; set; }
  16. public virtual DbSet<MigrationHistory> MigrationHistories { get; set; }
  17. protected override void OnModelCreating(ModelBuilder modelBuilder)
  18. {
  19. modelBuilder.UseCollation("Chinese_Taiwan_Stroke_CI_AS");
  20. modelBuilder.Entity<MachineConnectionLog>(entity =>
  21. {
  22. entity.HasKey(e => e.Id).HasName("PK_dbo.MachineConnectionLog");
  23. entity.ToTable("MachineConnectionLog");
  24. entity.Property(e => e.ChargeBoxId).HasMaxLength(128);
  25. entity.Property(e => e.CreatedOn).HasColumnType("datetime");
  26. entity.Property(e => e.Data).HasMaxLength(3600);
  27. entity.Property(e => e.EvseendPoint)
  28. .HasMaxLength(25)
  29. .HasColumnName("EVSEEndPoint");
  30. entity.Property(e => e.MessageType).HasMaxLength(50);
  31. entity.Property(e => e.Msg).HasMaxLength(200);
  32. entity.Property(e => e.Session).HasMaxLength(36);
  33. });
  34. modelBuilder.Entity<MigrationHistory>(entity =>
  35. {
  36. entity.HasKey(e => new { e.MigrationId, e.ContextKey }).HasName("PK_dbo.__MigrationHistory");
  37. entity.ToTable("__MigrationHistory");
  38. entity.Property(e => e.MigrationId).HasMaxLength(150);
  39. entity.Property(e => e.ContextKey).HasMaxLength(300);
  40. entity.Property(e => e.Model).IsRequired();
  41. entity.Property(e => e.ProductVersion)
  42. .IsRequired()
  43. .HasMaxLength(32);
  44. });
  45. OnModelCreatingPartial(modelBuilder);
  46. }
  47. partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
  48. }