.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>();

 

posted @ 2021-03-09 16:31  姚赛  阅读(223)  评论(0编辑  收藏  举报