Exemplo n.º 1
0
        /// <summary>
        /// Add context when create department
        /// </summary>
        public void AddChildConnectionString(ConnectionStrings connectionStrings)
        {
            var optionsBuilder = new DbContextOptionsBuilder <CRM_MPContext>();

            optionsBuilder.UseSqlServer(connectionStrings.ConnectionValue);
            CRM_MPContext dbcontext = new CRM_MPContext(optionsBuilder.Options);

            DbContextMap.Add(connectionStrings.ConnectionKey, dbcontext);
        }
Exemplo n.º 2
0
 public void LoadContext(string orgCode, IDistributedCache distributedCache)
 {
     if (db == null || strConnect != orgCode)
     {
         string conn           = EncryptionConstant.SQL_MP_CONNECTION;
         var    optionsBuilder = new DbContextOptionsBuilder <CRM_MPContext>();
         optionsBuilder.UseSqlServer(conn.Replace(EncryptionConstant.MP, orgCode), providerOptions => providerOptions.CommandTimeout(300));
         db = new CRM_MPContext(optionsBuilder.Options);
     }
     _distributedCache = distributedCache;
 }
Exemplo n.º 3
0
 public void LoadContext(string orgCode, IDistributedCache distributed)
 {
     if (db == null || strconnect != orgCode)
     {
         string conn           = CategoryConstant.SQL_CONNECTION;
         var    optionsBuilder = new DbContextOptionsBuilder <CRM_MPContext>();
         optionsBuilder.UseSqlServer(conn.Replace("MP", orgCode), providerOptions => providerOptions.CommandTimeout(300));
         db = new CRM_MPContext(optionsBuilder.Options);
     }
     sp = new SP_Attributes(db);
     _distributedCache = distributed;
 }
Exemplo n.º 4
0
 public void SetConnectionString(Dictionary <string, string> connStrs)
 {
     ConnStrings = connStrs;
     if (DbContextMap == null)
     {
         DbContextMap = new Dictionary <string, CRM_MPContext>();
         foreach (var cons in ConnStrings)
         {
             //CRM_MPContext dbcontext = new CRM_MPContext(cons.Value);
             var optionsBuilder = new DbContextOptionsBuilder <CRM_MPContext>();
             optionsBuilder.UseSqlServer(cons.Value);
             CRM_MPContext dbcontext = new CRM_MPContext(optionsBuilder.Options);
             DbContextMap.Add(cons.Key, dbcontext);
         }
     }
 }
Exemplo n.º 5
0
 public SP_VOCProcess(CRM_MPContext context)
 {
     db = context;
 }
Exemplo n.º 6
0
 public SP_Attributes(CRM_MPContext context)
 {
     db = context;
 }
Exemplo n.º 7
0
 public CimsDA_SP(CRM_MPContext context)
 {
     db = context;
 }