.net core mysql ef 使用

Scaffold-DbContext "Server=*******;port=2468;uid=root;pwd=123456;Database=db;" Pomelo.EntityFrameworkCore.MySql -OutputDir Dao -f

            // For MySql
            services.AddDbContextPool<IdentityDbContext>(
              dbContextOptions => dbContextOptions
                  .UseMySql(
                      // Replace with your connection string.
                      Configuration.GetConnectionString("Database"),
                      mySqlOptions => {
                          mySqlOptions.CharSetBehavior(CharSetBehavior.NeverAppend);
                      })
                  // Everything from this point on is optional but helps with debugging.
                  .EnableSensitiveDataLogging(false)
                  .EnableDetailedErrors()
            );
            services.AddDbContext<Dao.E11Context>();
services.AddDbContext<Dao.e11_tempContext>();
原文地址:https://www.cnblogs.com/zisai/p/14506350.html