Example #1
0
        /// <summary>
        /// Builds a <see cref="Statement"/> for a statement configuration.
        /// </summary>
        /// <param name="statementConfig">The statement config.</param>
        /// <param name="configurationSetting"></param>
        private IMappedStatement BuildStatement(IConfiguration statementConfig, ConfigurationSetting configurationSetting)
        {
            BaseStatementDeSerializer statementDeSerializer = new StatementDeSerializer();
            //解析statement节点属性到类中
            IStatement statement = statementDeSerializer.Deserialize(modelStore, statementConfig, configurationSetting);
            //估计是处理statement节点对应的文本内容  ----->确实如此 此处是个核心 一个statement节点的配置信息 和 对应的内存类
            //处理的结果放在了statement中 包括了要执行的sql语句和参数
            ProcessSqlStatement(statementConfig, statement);

            //具体封装了IDbcommand IDataReader的一些类
            MappedStatement mappedStatement = new MappedStatement(modelStore, statement);

            //放入缓存类中 并返回mappedStatement
            return BuildCachingStatement(statement, mappedStatement);
        }
Example #2
0
        /// <summary>
        /// Builds a <see cref="Statement"/> for a statement configuration.
        /// </summary>
        /// <param name="statementConfig">The statement config.</param>
        /// <param name="configurationSetting"></param>
        private IMappedStatement BuildStatement(IConfiguration statementConfig, ConfigurationSetting configurationSetting)
        {
            BaseStatementDeSerializer statementDeSerializer = new StatementDeSerializer();
            IStatement statement = statementDeSerializer.Deserialize(modelStore, statementConfig, configurationSetting);
            ProcessSqlStatement(statementConfig, statement);
            MappedStatement mappedStatement = new MappedStatement(modelStore, statement);

            return BuildCachingStatement(statement, mappedStatement);
        }