zoukankan      html  css  js  c++  java
  • netcore数据连接配置

    netcore数据连接配置

    第一种

    appsettings.json

    {
    
      "ConnectionStrings": {
        "DefaultConnection": "Server=localhost;database=typecho;uid=root;pwd=woshishui;"
      },
      "Logging": {
        "LogLevel": {
          "Default": "Information",
          "Microsoft": "Warning",
          "Microsoft.Hosting.Lifetime": "Information"
        }
      },
      "AllowedHosts": "*"
    }
    
    

    ConfigureServices

     services.AddDbContext<typechoContext>(options=>options.UseMySql(Configuration.GetConnectionString("DefaultConnection")));
    
    
    

    第二种

    ConfigureServices

          // other service configurations go here
                // replace "YourDbContext" with the class name of your DbContext
    services.AddDbContextPool<typechoContext>(options => options
                //     // replace with your connection string          .UseMySql("Server=localhost;Database=typecho;User=root;Password=woshishui;", mySqlOptions => mySqlOptions
                //         // replace with your Server Version and Type
        .ServerVersion(new ServerVersion(new Version(8, 0, 19), ServerType.MySql))
                //     ));
    
  • 相关阅读:
    主成分分析法
    K-means算法
    高斯混合模型
    data structure test
    八皇后问题求解
    商品管理系统课程设计
    哈佛商学院20部必看电影
    usaco1.1
    Visual Studio 2012 出现关于ActivityLog.xml错误的解决方案
    2012蓝桥杯决赛题
  • 原文地址:https://www.cnblogs.com/ouyangkai/p/12795695.html
Copyright © 2011-2022 走看看