TeamDataContext.cs 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. using Microsoft.EntityFrameworkCore;
  2. using System;
  3. using Repository.Entiies;
  4. using Microsoft.EntityFrameworkCore.Metadata.Builders;
  5. namespace Repository
  6. {
  7. public class TeamDataContext : DbContext
  8. {
  9. protected override void OnConfiguring(DbContextOptionsBuilder options)
  10. {
  11. options.EnableSensitiveDataLogging();
  12. var connetionString = $"Data Source={AppDomain.CurrentDomain.BaseDirectory}data.db";
  13. options.UseSqlite(connetionString).UseQueryTrackingBehavior(QueryTrackingBehavior.NoTracking);
  14. base.OnConfiguring(options);
  15. }
  16. public DbSet<TestResult> ProductResult { get; set; }
  17. public DbSet<ParamLog> ParamLogs { get; set; }
  18. public DbSet<StatisticsLog> StatisticsLogs { get; set; }
  19. public DbSet<Information> Informations { get; set; }
  20. public DbSet<SopFile> SopFiles { get; set; }
  21. public DbSet<LocalFileDb> LocalFile { get; set; }
  22. public DbSet<LocalFile2Db> LocalFile2 { get; set; }
  23. public DbSet<LocalFile3Db> LocalFile3 { get; set; }
  24. public DbSet<Account> Accounts { get; set; }
  25. public DbSet<Person> Persons { get; set; }
  26. public DbSet<House> Houses { get; set; }
  27. public DbSet<Quality> Qualitys { get; set; }
  28. public DbSet<OutofWork> OutofWorks { get; set; }
  29. public DbSet<ProStatus> ProStatus { get; set; }
  30. public DbSet<AllNumber> AllNumbers { get; set; }
  31. public DbSet<DeviceStatus> DeviceStatus { get; set; }
  32. }
  33. public class CustomerDataContext : DbContext
  34. {
  35. protected override void OnConfiguring(DbContextOptionsBuilder options)
  36. {
  37. options.EnableSensitiveDataLogging();
  38. var connetionString = $"Data Source=124.71.173.222;Initial Catalog=AIS20220504021055;Persist Security Info=True;User ID=sa;Password=jlkj123@;Encrypt=False";
  39. //$"Data Source=124.71.173.222;Initial Catalog=AIS20220504021055;User ID=sa;Password=jlkj123@;Encrypt=True;TrustServerCertificate=True";
  40. options.UseSqlServer(connetionString).UseQueryTrackingBehavior(QueryTrackingBehavior.NoTracking);
  41. base.OnConfiguring(options);
  42. }
  43. public DbSet<Table> Table { get; set; }//查看别人的数据库不能有s
  44. public DbSet<ICMO> ICMO { get; set; }
  45. public DbSet<t_PDABarCodeSign> t_PDABarCodeSign { get; set; }
  46. }
  47. }