zoukankan      html  css  js  c++  java
  • EF数据迁移时所需要的连接字符串

    一、EF数据迁移时所需要的连接接字符串,需要配置在app.config文件中,但不是编译后的app.config文件,

    即不是bin文件夹下面的app.config文件,而是解决方案根目录下的app.config文件,如下图:

    二、在预定义的app.config文件中也可对连接字符串加密,具体参照以下博文

     https://www.cnblogs.com/windy3417/p/13718071.html

    加密连接字符串示例:

     <add name="myConection" connectionString="f7eDavRqKzXNscJQ7XKStg4/cE7b+Ntyb51RytyXTc5njuOvEZ132dIaNT6AylVmkYZkytYZo0Eta8p37aQwaPQ2ayq8taAS9Z/Y/J1bx9uUpcUtEqbIn/RtqMT2vYYzpU+5/pHsODA="
      providerName="System.Data.SqlClient" />

     三、数据迁移时的连接字符串解密

    因在数据迁移时,也会执行DBContext类中的代码,所以可在DBContext类中设置解密方法,如下

       public class ItContext : DbContext
        {
           
            public ItContext()
                : base(Utility.Sql.Sqlhelper.sqlConnection(),true)
            {
            }
    
           
    
            // public virtual DbSet<MyEntity> MyEntities { get; set; }
            public virtual DbSet<WebURLModle> WebURLs { get; set; }
        }
    以上人代码中Utility.Sql.Sqlhelper.sqlConnection()返回的就已经是解密的sqlconection类
  • 相关阅读:
    https://leetcode-cn.com/problems/binary-search/solution/er-fen-cha-zhao-by-leetcode/
    Question_add-two-numbers
    leetcode merge-two-sorted-lists
    leetcode 1108
    leetcode 1107
    git
    sql 语句
    cas
    OMP 算法
    OC----预处理器
  • 原文地址:https://www.cnblogs.com/windy3417/p/14005550.html
Copyright © 2011-2022 走看看