namespace EVCB_OCPP.Domain
{
    using EVCB_OCPP.Domain.Models.Database;
    using System;
    using System.Data.Entity;
    using System.Linq;

    public class ConnectionLogDBContext : DbContext
    {
        // 您的內容已設定為使用應用程式組態檔 (App.config 或 Web.config)
        // 中的 'ConnectionLogDBContext' 連接字串。根據預設,這個連接字串的目標是
        // 您的 LocalDb 執行個體上的 'EVCB_OCPP.Domain.ConnectionLogDBContext' 資料庫。
        // 
        // 如果您的目標是其他資料庫和 (或) 提供者,請修改
        // 應用程式組態檔中的 'ConnectionLogDBContext' 連接字串。
        public ConnectionLogDBContext()
            : base("name=ConnectionLogDBContext")
        {
            Database.SetInitializer<ConnectionLogDBContext>(null);
            this.Configuration.AutoDetectChangesEnabled = false;
            this.Configuration.ValidateOnSaveEnabled = false;
            this.Configuration.AutoDetectChangesEnabled = false;
            this.Configuration.LazyLoadingEnabled = false;
            this.Database.CommandTimeout = 180;
        }

        /// <summary>
        /// DB coneection set
        /// </summary>
        public ConnectionLogDBContext(string conn)
        {
            this.Database.Connection.ConnectionString = conn;
            this.Configuration.AutoDetectChangesEnabled = false;
            this.Configuration.ValidateOnSaveEnabled = false;
            this.Configuration.AutoDetectChangesEnabled = false;
            this.Configuration.LazyLoadingEnabled = false;
            this.Database.CommandTimeout = 180;
        }

        // 針對您要包含在模型中的每種實體類型新增 DbSet。如需有關設定和使用
        // Code First 模型的詳細資訊,請參閱 http://go.microsoft.com/fwlink/?LinkId=390109。

        public virtual DbSet<MachineConnectionLog> MachineConnectionLog { get; set; }
    }

    //public class MyEntity
    //{
    //    public int Id { get; set; }
    //    public string Name { get; set; }
    //}
}