using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata;

// Code scaffolded by EF Core assumes nullable reference types (NRTs) are not used or disabled.
// If you have enabled NRTs for your project, then un-comment the following line:
// #nullable disable

namespace MS.WebApi.SQLite
{
    public partial class smartfueltoolContext : DbContext
    {
        public smartfueltoolContext()
        {
        }

        public smartfueltoolContext(DbContextOptions<smartfueltoolContext> options)
            : base(options)
        {
        }

        public virtual DbSet<BuidMembershipGroup> BuidMembershipGroup { get; set; }
        public virtual DbSet<MembershipGroupList> MembershipGroupList { get; set; }

        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        {
            if (!optionsBuilder.IsConfigured)
            {
#warning To protect potentially sensitive information in your connection string, you should move it out of source code. See http://go.microsoft.com/fwlink/?LinkId=723263 for guidance on storing connection strings.
                optionsBuilder.UseSqlite("Data Source=C:\\cw\\demo\\smartfueltool\\smartfueltool.db");
            }
        }

        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            modelBuilder.Entity<BuidMembershipGroup>(entity =>
            {
                entity.ToTable("buid_membershipGroup");

                entity.Property(e => e.Id)
                    .HasColumnName("id")
                    .ValueGeneratedNever();

                entity.Property(e => e.CurrentBuId)
                    .HasColumnName("currentBuId")
                    .HasColumnType("varchar(100)");

                entity.Property(e => e.MembershipGroupId)
                    .HasColumnName("membership_group_id")
                    .HasColumnType("varchar(50)");
            });

            modelBuilder.Entity<MembershipGroupList>(entity =>
            {
                entity.ToTable("membershipGroupList");

                entity.Property(e => e.Id)
                    .HasColumnName("id")
                    .ValueGeneratedNever();

                entity.Property(e => e.CurrentBuId)
                    .HasColumnName("currentBuId")
                    .HasColumnType("varchar(100)");

                entity.Property(e => e.Phone)
                    .HasColumnName("phone")
                    .HasColumnType("varchar(20)");

                entity.Property(e => e.UpdateStatus).HasColumnType("varchar(1)");
            });

            OnModelCreatingPartial(modelBuilder);
        }

        partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
    }
}
