ConnectionLogDBContext.cs 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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. // protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
  17. //#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.
  18. // => 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");
  19. protected override void OnModelCreating(ModelBuilder modelBuilder)
  20. {
  21. modelBuilder.UseCollation("Chinese_Taiwan_Stroke_CI_AS");
  22. modelBuilder.Entity<MachineConnectionLog>(entity =>
  23. {
  24. entity.HasKey(e => new { e.Id, e.CreatedOn });
  25. entity.ToTable("MachineConnectionLog");
  26. entity.Property(e => e.Id).ValueGeneratedOnAdd();
  27. entity.Property(e => e.CreatedOn).HasColumnType("datetime");
  28. entity.Property(e => e.ChargeBoxId).HasMaxLength(128);
  29. entity.Property(e => e.Data).HasMaxLength(3600);
  30. entity.Property(e => e.EvseendPoint)
  31. .HasMaxLength(25)
  32. .HasColumnName("EVSEEndPoint");
  33. entity.Property(e => e.MessageType).HasMaxLength(50);
  34. entity.Property(e => e.Msg).HasMaxLength(200);
  35. entity.Property(e => e.Session).HasMaxLength(36);
  36. });
  37. OnModelCreatingPartial(modelBuilder);
  38. }
  39. partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
  40. }