コード例 #1
0
 /// <summary>
 ///		Constructor set connection, transaction and generates model
 ///		data map from model type input
 /// </summary>
 /// <param name="conn">
 ///		Connection object
 /// </param>
 /// <param name="modelType">
 ///		GlobalTranz.Framework.Common.Models type
 /// </param>
 /// <param name="transaction">
 ///		SQL transaction object.
 /// </param>
 public SqlDataAccessor(IDbConnection conn, Type modelType, IDbTransaction transaction)
 {
     this.connection     = conn;
     this.modelType      = modelType;
     this.transaction    = transaction;
     this.modelDataMap   = ModelDataMap.GetDataMap(modelType);
     this.commandBuilder = SqlFrameworkCommandBuilder.GetSqlStringBuilder(this.modelDataMap, modelType);
 }
コード例 #2
0
        /// <summary>
        ///     Create select sql statement
        /// </summary>
        /// <param name="modelDataMap">
        ///     Model data map object
        /// </param>
        /// <param name="modelType">
        ///     Type of model
        /// </param>
        /// <returns>
        ///     Command builder object with sql query.
        /// </returns>
        public static SqlFrameworkCommandBuilder GetSqlStringBuilder(
            ModelDataMap modelDataMap,
            Type modelType)
        {
            SqlFrameworkCommandBuilder b = (SqlFrameworkCommandBuilder)sqlMap[modelType];

            if (b == null)
            {
                b = new SqlFrameworkCommandBuilder(modelDataMap, modelType);
                sqlMap[modelType] = b;
            }

            return(b);
        }