コード例 #1
0
 public static void SetDbContextConnection(VOLContext beefContext, string dbName)
 {
     if (!ConnectionPool.ContainsKey(dbName))
     {
         throw new Exception("数据库连接名称错误");
     }
     beefContext.Database.GetDbConnection().ConnectionString = ConnectionPool[dbName];
 }
コード例 #2
0
 /// <summary>
 /// 获取实体的数据库连接
 /// </summary>
 /// <typeparam name="TEntity"></typeparam>
 /// <param name="defaultDbContext"></param>
 /// <returns></returns>
 public static void GetDbContextConnection <TEntity>(VOLContext defaultDbContext)
 {
     //string connstr= defaultDbContext.Database.GetDbConnection().ConnectionString;
     // if (connstr != ConnectionPool[DefaultConnName])
     // {
     //     defaultDbContext.Database.GetDbConnection().ConnectionString = ConnectionPool[DefaultConnName];
     // };
 }
コード例 #3
0
        public static VOLContext GetEFDbContext(string dbName)
        {
            VOLContext beefContext = Utilities.HttpContext.Current.RequestServices.GetService(typeof(VOLContext)) as VOLContext;

            if (dbName != null)
            {
                if (!ConnectionPool.ContainsKey(dbName))
                {
                    throw new Exception("数据库连接名称错误");
                }
                beefContext.Database.GetDbConnection().ConnectionString = ConnectionPool[dbName];
            }
            return(beefContext);
        }
コード例 #4
0
        public async Task <IViewComponentResult> InvokeAsync(string dropDownIds)
        {
            if (string.IsNullOrEmpty(dropDownIds))
            {
                return(null);
            }

            string[]      dicNos        = dropDownIds.Split(',');
            StringBuilder stringBuilder = new StringBuilder();
            VOLContext    context       = DBServerProvider.GetEFDbContext();
            var           dicData       = await(from d in context.Set <Sys_Dictionary>()
                                                join list in context.Set <Sys_DictionaryList>()
                                                on d.Dic_ID equals list.Dic_ID
                                                into t
                                                from list in t.DefaultIfEmpty()
                                                where dicNos.Contains(d.DicNo)
                                                select new { list.DicValue, list.DicName, d.Config, d.DbSql, list.OrderNo, d.DicNo }).ToListAsync();

            foreach (var item in dicData.GroupBy(x => x.DicNo))
            {
                stringBuilder.AppendLine($" var optionConfig{item.Key} = {item.Select(x => x.Config).FirstOrDefault()}");

                string dbSql = item.Select(s => s.DbSql).FirstOrDefault();

                stringBuilder.AppendLine($@" var dataSource{item.Key} = {
                    (!string.IsNullOrEmpty(dbSql)
                    ? DBServerProvider.GetSqlDapper().QueryList<object>(dbSql, null).Serialize()
                    : item.OrderByDescending(o => o.OrderNo).
                            Select(s => new { s.DicName, s.DicValue }).ToList()
                            .Serialize())
                     }.convertToValueText(optionConfig{item.Key})");
                stringBuilder.AppendLine($" optionConfig{item.Key}.data = dataSource{item.Key};");
            }
            ViewBag.Dic = stringBuilder.ToString();
            return(View("~/Views/Shared/Dictionary.cshtml"));
        }
コード例 #5
0
 public Hiiops_Shop_User_GroupRepository(VOLContext dbContext)
     : base(dbContext)
 {
 }
コード例 #6
0
 public vProvinceCityRepository(VOLContext dbContext)
     : base(dbContext)
 {
 }
コード例 #7
0
 public Wms_ProductCatalogRepository(VOLContext dbContext)
     : base(dbContext)
 {
 }
 public Hiiops_Shop_Store_Product_AttrRepository(VOLContext dbContext)
     : base(dbContext)
 {
 }
コード例 #9
0
 public PartsRepository(VOLContext dbContext)
     : base(dbContext)
 {
 }
コード例 #10
0
 public BaseService(VOLContext dbContext)
 {
     Response = new WebResponseContent(true);
     this.DefaultDbContext = dbContext ?? throw new Exception("dbContext未实例化。");
 }
コード例 #11
0
 public RepositoryBase(VOLContext dbContext)
 {
     this.DefaultDbContext = dbContext ?? throw new Exception("dbContext未实例化。");
 }
コード例 #12
0
 public Sys_TableInfoRepository(VOLContext dbContext)
     : base(dbContext)
 {
 }
コード例 #13
0
 public App_PublicQuestionRepository(VOLContext dbContext)
     : base(dbContext)
 {
 }
コード例 #14
0
 public Sys_RoleRepository(VOLContext dbContext)
     : base(dbContext)
 {
 }
コード例 #15
0
 public ProductRepository(VOLContext dbContext)
     : base(dbContext)
 {
 }
コード例 #16
0
ファイル: NewsPraiseRepository.cs プロジェクト: guipie/Api
 public NewsPraiseRepository(VOLContext dbContext)
     : base(dbContext)
 {
 }
コード例 #17
0
 public Sys_LogRepository(VOLContext dbContext)
     : base(dbContext)
 {
 }
コード例 #18
0
 public Sys_DictionaryListRepository(VOLContext dbContext)
     : base(dbContext)
 {
 }
コード例 #19
0
 public App_TransactionAvgPriceRepository(VOLContext dbContext)
     : base(dbContext)
 {
 }
コード例 #20
0
 public App_ExpertQuestionRepository(VOLContext dbContext)
     : base(dbContext)
 {
 }
コード例 #21
0
 public vApp_QuestionReplyMeRepository(VOLContext dbContext)
     : base(dbContext)
 {
 }
コード例 #22
0
 public Sys_UserRepository(VOLContext dbContext)
     : base(dbContext)
 {
 }
コード例 #23
0
 public SellOrderRepository(VOLContext dbContext)
     : base(dbContext)
 {
 }
コード例 #24
0
 public FormCollectionObjectRepository(VOLContext dbContext)
     : base(dbContext)
 {
 }
コード例 #25
0
 public NewsTagRepository(VOLContext dbContext)
     : base(dbContext)
 {
 }
コード例 #26
0
 public Hiiops_Shop_Store_ServiceRepository(VOLContext dbContext)
     : base(dbContext)
 {
 }
コード例 #27
0
 public vSys_DictionaryRepository(VOLContext dbContext)
     : base(dbContext)
 {
 }
コード例 #28
0
 public Sys_MenuRepository(VOLContext dbContext)
     : base(dbContext)
 {
 }
コード例 #29
0
 public GoodsRepository(VOLContext dbContext)
     : base(dbContext)
 {
 }
コード例 #30
0
 public Hiiops_Shop_Store_Coupon_Issue_UserRepository(VOLContext dbContext)
     : base(dbContext)
 {
 }