Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8048919
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T06:38:01+00:00 2026-06-05T06:38:01+00:00

ActionSuccess callback with IncrementKey does not work in transaction: public class Article { public

  • 0

ActionSuccess callback with IncrementKey does not work in transaction:

public class Article
{
    public long Id { get; set; }
    public string Name { get; set; }
}

[Test]
public void Can_create_article_with_autoincremental-id()
{
    Article a = new Article() { Name = "I Love Writing Test" };
    using (var trans = Redis.CreateTransaction())
    {
        trans.QueueCommand(r => r.IncrementValue("id:article"), id => a.Id = id);
        trans.QueueCommand(r => r.Store<Article>(a));

        trans.Commit();
    }

    Assert.That(Redis.Get<Article>("1").Id,Is.Equal("1"));
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T06:38:02+00:00Added an answer on June 5, 2026 at 6:38 am

    Redis transactions are all executed at the same time where callbacks only fire after the entire transaction has been completed. So you cannot use the return values in the callbacks within the same transaction in another part of that transaction.

    If you just wanted to store an Article with an autoincrementing Id counter, you can simply do:

    var a = new Article { 
       Id = Redis.As<Article>().GetNextSequence(), 
       Name = "I Love Writing Test" 
    };
    Redis.Store(a);
    

    There’s no need for the transaction for this. To use values from Redis inside a transaction which will only execute if none of the values have changed use the WATCH command. See my earlier answer for an example.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

any time i write this: $this->setTemplate('module/action'); I'm getting this error: The template module/actionSuccess.php does
I'm using JSR-286 + Struts 2.2.0 + PortletPlugin 2.2.0 I can't set name for
I need to check if success is true or false. i get the following
So, I have next situation: I have a page with form -> this form
i am trying to return just one piece of data from amazon by connecting
I'm using a table to update a database, the table has 264 checkboxes which
I'm writing a REST service in Erlang and need to verify the received data
The following code is intended to do a purely ajax POST request, instead it
Once more here I come with a question of s2, I'm a beginner at
I am trying to obtain JSON object in the following code. The problem is,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.