question

patrick avatar image
patrick asked

If ProfileVersion is 0 then ExpectedProfileVersion needs to be 0 (but that appears to mean always write!)

Working in Postman, if an entity has a ProfileVersion of 0 then I have to specify 0 in order to write. However it appears that if ExpectedProfileVersion is 0 that means ALWAYS write.

So it breaks the concurrency at least in this case...


  1. Request 1 check GetProfile (ProfileVersion = 0)
  2. Request 2 check GetProfile (ProfileVersion = 0)
  3. Request 2 SetObjects (ExpectedProfileVersion = 0)
  4. Request 1 SetObjects (ExpectedProfileVersion = 0)

Step 4 succeeds even though it the ProfileVersion is now 1.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
JayZuo avatar image
JayZuo answered

You are right, 0 is a special value for ExpectedProfileVersion. As you can find in SetObjects method, ExpectedProfileVersion is a optional field, if it is not set on the request then the object will always be updated if the values differ. And when ExpectedProfileVersion is set to 0, as 0 is the default value of int32, the system will treat it as the same as it's not set, thus will cause ALWAYS write.

If you use another value to test, the profile version system should work well. For example,

  1. Request 1 check GetProfile (ProfileVersion = 1)
  2. Request 2 check GetProfile (ProfileVersion = 1)
  3. Request 2 SetObjects (ExpectedProfileVersion = 1)
  4. Request 1 SetObjects (ExpectedProfileVersion = 1)

In this scenario, step 4 will fail and give a "EntityProfileVersionMismatch" error.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.