123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- namespace EVCB_OCPP.Domain
- {
- using EVCB_OCPP.Domain.Models.Database;
- using Microsoft.EntityFrameworkCore;
- using System;
- using System.Linq;
- public class ConnectionLogDBContext : DbContext
- {
- // 您的內容已設定為使用應用程式組態檔 (App.config 或 Web.config)
- // 中的 'ConnectionLogDBContext' 連接字串。根據預設,這個連接字串的目標是
- // 您的 LocalDb 執行個體上的 'EVCB_OCPP.Domain.ConnectionLogDBContext' 資料庫。
- //
- // 如果您的目標是其他資料庫和 (或) 提供者,請修改
- // 應用程式組態檔中的 'ConnectionLogDBContext' 連接字串。
- public ConnectionLogDBContext(): base()
- {
- //Database.SetInitializer<ConnectionLogDBContext>(null);
- //this.Configuration.AutoDetectChangesEnabled = false;
- //this.Configuration.ValidateOnSaveEnabled = false;
- //this.Configuration.AutoDetectChangesEnabled = false;
- //this.Configuration.LazyLoadingEnabled = false;
- //this.Database.CommandTimeout = 180;
- }
- public ConnectionLogDBContext(DbContextOptions<ConnectionLogDBContext> options) : base(options)
- {
- }
- // 針對您要包含在模型中的每種實體類型新增 DbSet。如需有關設定和使用
- // Code First 模型的詳細資訊,請參閱 http://go.microsoft.com/fwlink/?LinkId=390109。
- public virtual DbSet<MachineConnectionLog> MachineConnectionLog { get; set; }
- protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
- {
- //optionsBuilder.UseSqlServer("data source=172.1.2.187;initial catalog=StandardOCPP_ConnectionLog;persist security info=True;user id=sa;password=Ph0930118811;MultipleActiveResultSets=True;App=EntityFramework");
- base.OnConfiguring(optionsBuilder);
- }
- }
- //public class MyEntity
- //{
- // public int Id { get; set; }
- // public string Name { get; set; }
- //}
- }
|