MeterValueDBContext.cs 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. using System;
  2. using System.Collections.Generic;
  3. using EVCB_OCPP.Domain.Models.MeterValueDb;
  4. using Microsoft.EntityFrameworkCore;
  5. namespace EVCB_OCPP.Domain;
  6. public partial class MeterValueDBContext : DbContext
  7. {
  8. public MeterValueDBContext()
  9. {
  10. }
  11. public MeterValueDBContext(DbContextOptions<MeterValueDBContext> options)
  12. : base(options)
  13. {
  14. }
  15. public virtual DbSet<ConnectorMeterValueRecord> ConnectorMeterValueRecords { 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<ConnectorMeterValueRecord>(entity =>
  21. {
  22. entity
  23. .HasNoKey()
  24. .ToTable("ConnectorMeterValueRecord");
  25. entity.Property(e => e.ChargeBoxId).HasMaxLength(50);
  26. entity.Property(e => e.CreatedOn).HasColumnType("smalldatetime");
  27. entity.Property(e => e.Value).HasMaxLength(10);
  28. });
  29. modelBuilder.Entity<MigrationHistory>(entity =>
  30. {
  31. entity
  32. .HasNoKey()
  33. .ToTable("__MigrationHistory");
  34. entity.Property(e => e.ContextKey)
  35. .IsRequired()
  36. .HasMaxLength(300);
  37. entity.Property(e => e.MigrationId)
  38. .IsRequired()
  39. .HasMaxLength(150);
  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. }