Ejemplo n.º 1
0
        /// <summary>
        /// 代码构成享元模板
        /// </summary>
        /// <param name="isNotCondition"></param>
        /// <param name="parameters"></param>
        /// <param name="tryCodeStatementCollection"></param>
        /// <param name="paramterQuery"></param>
        /// <param name="type"></param>
        /// <param name="sqls"></param>
        /// <param name="stringBuilderBlueprint"></param>
        protected void Building(bool isNotCondition
                                , Dictionary <int, List <Dictionary <PARAMETER, string> > > parameters
                                , CodeStatementCollection tryCodeStatementCollection
                                , IParamterQuery paramterQuery
                                , Type type
                                , List <SqlFormat> sqls
                                , StringBuilderBlueprint stringBuilderBlueprint
                                , string query
                                , string connection
                                , ITemplateBlueprint templateBlueprint
                                , ListBlueprint listBlueprint)
        {
            Dictionary <string, string> SavePar = new Dictionary <string, string>();

            //按顺序添加SQL语句以及条件语句
            for (int sQLsCount = 0; sQLsCount < sqls.Count; sQLsCount++)
            {
                tryCodeStatementCollection.Add(stringBuilderBlueprint.Append(sqls[sQLsCount].SQLText));
                if (!isNotCondition)
                {
                    int CondiIndex = sqls[sQLsCount].CondiIndex;
                    if (CondiIndex != -1)
                    {
                        CreateCondition(SavePar, CondiIndex, parameters, tryCodeStatementCollection, paramterQuery, sqls, sQLsCount, stringBuilderBlueprint, sqls[sQLsCount].oNDITION_TYPE);
                    }
                }
            }

            //返回值
            ReturnBlueprint returnBlueprint = new ReturnBlueprint();

            switch (query)
            {
            case "select":
                SelectReturn(connection
                             , tryCodeStatementCollection
                             , templateBlueprint
                             , returnBlueprint
                             , stringBuilderBlueprint
                             , listBlueprint);
                break;

            default:
                DefaultReturn(connection
                              , tryCodeStatementCollection
                              , templateBlueprint
                              , returnBlueprint
                              , stringBuilderBlueprint
                              , listBlueprint);
                break;
            }
        }
Ejemplo n.º 2
0
 protected override void SelectReturn(string connection, CodeStatementCollection codeStatementCollection, ITemplateBlueprint templateBlueprint, ReturnBlueprint returnBlueprint, StringBuilderBlueprint stringBuilderBlueprint, ListBlueprint listBlueprint)
 {
     codeStatementCollection.Add(returnBlueprint.ReturnExpress(templateBlueprint.ExecuteDataTable(connection
                                                                                                  , stringBuilderBlueprint.Field
                                                                                                  , listBlueprint.Field)));
 }
Ejemplo n.º 3
0
 protected abstract void DefaultReturn(string connection
                                       , CodeStatementCollection codeStatementCollection
                                       , ITemplateBlueprint templateBlueprint
                                       , ReturnBlueprint returnBlueprint
                                       , StringBuilderBlueprint stringBuilderBlueprint
                                       , ListBlueprint listBlueprint);