MeterValueDBContext.cs 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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. // protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
  16. //#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.
  17. // => 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");
  18. protected override void OnModelCreating(ModelBuilder modelBuilder)
  19. {
  20. modelBuilder.UseCollation("Chinese_Taiwan_Stroke_CI_AS");
  21. modelBuilder.Entity<ConnectorMeterValueRecord>(entity =>
  22. {
  23. entity
  24. .HasNoKey()
  25. .ToTable("ConnectorMeterValueRecord");
  26. entity.Property(e => e.ChargeBoxId).HasMaxLength(50);
  27. entity.Property(e => e.CreatedOn).HasColumnType("smalldatetime");
  28. entity.Property(e => e.Value).HasMaxLength(10);
  29. });
  30. OnModelCreatingPartial(modelBuilder);
  31. }
  32. partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
  33. }