コード例 #1
0
 public IUnitOfData FetchUnitofData(string name, bool isNew = false)
 {
     //string _regName = DBString.CreateRegName(fControlUnitID, products);
     if (isNew)
     {
         PageFlyweight.PageItems[name] = null;
     }
     if (PageFlyweight.PageItems[name] == null)
     {
         string connStr = DBString.GetAtawDatabaseValue(name);
         var    res     = new AtawDbContext(connStr);
         PageFlyweight.PageItems[name] = res;
         return(res);
     }
     else
     {
         return((IUnitOfData)PageFlyweight.PageItems[name]);
     }
 }
コード例 #2
0
        public IUnitOfData FetchUnitofData(string fControlUnitID, string products, bool isNew = false)
        {
            string _regName = DBString.CreateRegName(fControlUnitID, products);

            if (isNew)
            {
                PageFlyweight.PageItems[_regName] = null;
            }
            if (PageFlyweight.PageItems[_regName] == null)
            {
                string connStr = DBString.GetAtawControlUnitsProductValue(fControlUnitID, products.Value <ProductsType>(), "DB");
                var    res     = new AtawDbContext(connStr);
                PageFlyweight.PageItems[_regName] = res;
                return(res);
            }
            else
            {
                return((IUnitOfData)PageFlyweight.PageItems[_regName]);
            }
        }
コード例 #3
0
ファイル: AtawDBList.cs プロジェクト: mountain-pier/framework
        public AtawDbContext CreateAtawDbContext(string nameOrConnectionString)
        {
            AtawDbContext        dbCon     = null;
            List <AtawDbContext> dbConList = new List <AtawDbContext>();

            if (LdbCon != null)
            {
                dbConList = LdbCon;
            }
            if (LdbCon != null)
            {
                dbCon = LdbCon.Where(i => i.NameOrConnectionString == nameOrConnectionString).ToList().First();
            }

            if (dbCon == null)
            {
                dbCon = new AtawDbContext(nameOrConnectionString);
                dbConList.Add(dbCon);
                LdbCon = dbConList;
            }
            return(dbCon);
        }
コード例 #4
0
ファイル: AtawDBList.cs プロジェクト: mountain-pier/framework
 /// <summary>
 /// 注册事务
 /// </summary>
 /// <param name="dbcon">连接类</param>
 /// <param name="storedName">存储过程名称</param>
 /// <param name="param">存储过程参数</param>
 /// <returns>注册事务后的连接类</returns>
 public AtawDbContext RegisterStored(AtawDbContext dbcon, string storedName, params SqlParameter[] param)
 {
     dbcon.RegisterStored(storedName, param);
     return(dbcon);
 }