コード例 #1
0
ファイル: DbQueryBase.cs プロジェクト: wtfcolt/game
        /// <summary>
        /// Initializes a new instance of the <see cref="DbQueryBase"/> class.
        /// </summary>
        /// <param name="connectionPool">The <see cref="DbConnectionPool"/> to use for creating connections to execute the query on.</param>
        /// <param name="commandText">String containing the command to use for the query.</param>
        /// <exception cref="ArgumentNullException"><paramref name="connectionPool"/> is null.</exception>
        /// <exception cref="ArgumentNullException"><paramref name="commandText"/> is null or empty.</exception>
        protected DbQueryBase(DbConnectionPool connectionPool, string commandText)
        {
            if (connectionPool == null)
                throw new ArgumentNullException("connectionPool");
            if (string.IsNullOrEmpty(commandText))
                throw new ArgumentNullException("commandText");

            _connectionPool = connectionPool;
            _commandText = commandText;

            // Grab the parameters
            var p = InitializeParameters();
            if (p == null)
            {
                // No parameters specified - use the empty list
                _parameters = _emptyDbParameters;
            }
            else
            {
                // Use the given parameters, compacted since it is readonly
                _parameters = p.ToCompact();

                // Validate the supplied parameters
                ValidateParameters(_parameters);
            }
        }
コード例 #2
0
ファイル: DbManager.cs プロジェクト: mateuscezar/netgore
        /// <summary>
        /// Initializes a new instance of the <see cref="DbManager"/> class.
        /// </summary>
        /// <param name="connectionPool"><see cref="DbConnectionPool"/> to use to create the connections managed by
        /// this <see cref="DbManager"/>.</param>
        /// <exception cref="ArgumentNullException"><paramref name="connectionPool" /> is <c>null</c>.</exception>
        public DbManager(DbConnectionPool connectionPool)
        {
            if (connectionPool == null)
                throw new ArgumentNullException("connectionPool");

            _connectionPool = connectionPool;
        }
コード例 #3
0
ファイル: DbQueryNonReader.cs プロジェクト: wtfcolt/game
 /// <summary>
 /// Initializes a new instance of the <see cref="DbQueryNonReader"/> class.
 /// </summary>
 /// <param name="connectionPool">The <see cref="DbConnectionPool"/> to use for creating connections to execute the query on.</param>
 /// <param name="commandText">String containing the command to use for the query.</param>
 /// <exception cref="ArgumentNullException"><paramref name="connectionPool"/> is null.</exception>
 /// <exception cref="ArgumentNullException"><paramref name="commandText"/> is null or empty.</exception>
 protected DbQueryNonReader(DbConnectionPool connectionPool, string commandText) : base(connectionPool, commandText)
 {
 }
コード例 #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SelectRepeatableQuestsQuery"/> class.
 /// </summary>
 /// <param name="connectionPool"><see cref="DbConnectionPool"/> to use for creating connections to
 /// execute the query on.</param>
 public SelectRepeatableQuestsQuery(DbConnectionPool connectionPool)
     : base(connectionPool, CreateQuery(connectionPool.QueryBuilder))
 {
     QueryAsserts.ContainsColumns(QuestTable.DbColumns, "id", "repeatable");
 }
コード例 #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SetAccountCurrentIPsNullQuery"/> class.
 /// </summary>
 /// <param name="connectionPool">The connection pool.</param>
 public SetAccountCurrentIPsNullQuery(DbConnectionPool connectionPool)
     : base(connectionPool, CreateQuery(connectionPool.QueryBuilder))
 {
 }
コード例 #6
0
ファイル: SelectQuestIDsQuery.cs プロジェクト: wtfcolt/game
 /// <summary>
 /// Initializes a new instance of the <see cref="DbQueryReader"/> class.
 /// </summary>
 /// <param name="connectionPool">DbConnectionPool to use for creating connections to execute the query on.</param>
 public SelectQuestIDsQuery(DbConnectionPool connectionPool)
     : base(connectionPool, CreateQuery(connectionPool.QueryBuilder))
 {
     QueryAsserts.ArePrimaryKeys(QuestTable.DbKeyColumns, "id");
 }
コード例 #7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SelectShopIDsQuery"/> class.
 /// </summary>
 /// <param name="connectionPool">DbConnectionPool to use for creating connections to execute the query on.</param>
 public SelectShopIDsQuery(DbConnectionPool connectionPool)
     : base(connectionPool, CreateQuery(connectionPool.QueryBuilder))
 {
 }
コード例 #8
0
 /// <summary>
 /// DbQueryNonReader constructor.
 /// </summary>
 /// <param name="connectionPool">DbConnectionPool to use for creating connections to execute the query on.</param>
 public UpdateServerTimeQuery(DbConnectionPool connectionPool)
     : base(connectionPool, CreateQuery(connectionPool.QueryBuilder))
 {
 }
コード例 #9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SelectCharacterTemplateIDsQuery"/> class.
 /// </summary>
 /// <param name="connectionPool">The connection pool.</param>
 public SelectCharacterTemplateIDsQuery(DbConnectionPool connectionPool)
     : base(connectionPool, CreateQuery(connectionPool.QueryBuilder))
 {
     QueryAsserts.ArePrimaryKeys(CharacterTemplateTable.DbKeyColumns, "id");
 }