示例#1
0
        private void SetPagingCommandFor(DbCommand command, MsSqlMessageStoreConfiguration configuration, int pageSize,
                                         int pageNumber)
        {
            var pagingSqlFormat = "SELECT * FROM (SELECT ROW_NUMBER() OVER(ORDER BY Timestamp DESC) AS NUMBER, * FROM {0}) AS TBL WHERE NUMBER BETWEEN ((@PageNumber-1)*@PageSize+1) AND (@PageNumber*@PageSize) ORDER BY Timestamp DESC";
            var parameters      = new[]
            {
                CreateSqlParameter("PageNumber", pageNumber),
                CreateSqlParameter("PageSize", pageSize)
            };

            var sql = string.Format(pagingSqlFormat, _configuration.MessageStoreTableName);

            command.CommandText = sql;
            command.Parameters.AddRange(parameters);
        }
示例#2
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="MsSqlMessageStore" /> class.
 /// </summary>
 /// <param name="configuration">The configuration.</param>
 public MsSqlMessageStore(MsSqlMessageStoreConfiguration configuration)
 {
     _configuration            = configuration;
     ContinueOnCapturedContext = false;
 }