コード例 #1
0
        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        {
            var builder = new ConfigurationBuilder()
                          .SetBasePath(Directory.GetCurrentDirectory())
                          .AddJsonFile("appsettings.json");

            Configuration = builder.Build();

            string connectionString = Configuration.GetConnectionString("OnlineStoreContext");

            optionsBuilder.AddMySqlOptionBuilder(connectionString);
        }