Azure-docs: Is it safe to share references in objects inserted to reliable collections?

Created on 5 Mar 2019  Â·  5Comments  Â·  Source: MicrosoftDocs/azure-docs

Take example:

var project = new Project();
var personA = new Person(project);
var personB = new Person(project);

using (var tx = StateManager.CreateTransaction())
{
    await myDictionary.AddAsync(tx, personA.Id, personA);
    await myDictionary.AddAsync(tx, personB.Id, personB);
    await tx.CommitAsync();
}

using (var tx = StateManager.CreateTransaction())
{
    await myDictionary.TryRemoveAsync(tx, personA.Id);
    await tx.CommitAsync();
}

My assumption: Removal of personA from the collection doesn't affect personB's persisted state or current in-memory state even though they shared reference to same Project object? Objects in this case are immutable as is recommended.


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

cxp in-progress product-question service-fabrisvc triaged

All 5 comments

Thanks for the question! We are investigating and will update you shortly.

@aljo-microsoft to confirm

@juho-hanhimaki just FYI, I am still working to confirm this. I should have an answer this week.

@juho-hanhimaki well it took a while, but after discussing this with the Service Product team if the objects are immutable as recommended then your assumption is correct and you should have no issues :)

Thanks a ton!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bdcoder2 picture bdcoder2  Â·  3Comments

Agazoth picture Agazoth  Â·  3Comments

Favna picture Favna  Â·  3Comments

monteledwards picture monteledwards  Â·  3Comments

DeepPuddles picture DeepPuddles  Â·  3Comments